示例#1
0
        public static StackSource CPUStacks(this TraceLog eventLog, TraceProcess process = null, Predicate <TraceEvent> predicate = null)
        {
            TraceEvents events;

            if (process == null)
            {
                events = eventLog.Events.Filter((x) => ((predicate == null) || predicate(x)) && x is SampledProfileTraceData && x.ProcessID != 0);
            }
            else
            {
                events = process.EventsInProcess.Filter((x) => ((predicate == null) || predicate(x)) && x is SampledProfileTraceData);
            }

            var traceStackSource = new TraceEventStackSource(events);

            // We clone the samples so that we don't have to go back to the ETL file from here on.
            return(CopyStackSource.Clone(traceStackSource));
        }
        public static StackSource SingleEventTypeStack(this TraceEvents events, TraceProcess process = null, Predicate <TraceEvent> predicate = null)
        {
            // optimization only
            if (process != null)
            {
                var start = Math.Max(events.StartTimeRelativeMSec, process.StartTimeRelativeMsec);
                var end   = Math.Min(events.EndTimeRelativeMSec, process.EndTimeRelativeMsec);
                events = events.FilterByTime(start, end);
                events = events.Filter(x => (predicate == null || predicate(x)) && x.ProcessID == process.ProcessID);
            }
            else
            {
                events = events.Filter(x => (predicate == null || predicate(x)) && x.ProcessID != 0); // TODO: Is it really correc that x.ProcessID != 0 should be there? What if we want see these?
            }

            var traceStackSource = new TraceEventStackSource(events)
            {
                ShowUnknownAddresses = true
            };

            return(CopyStackSource.Clone(traceStackSource));
        }
示例#3
0
        public static StackSource CPUStacks(
            this Microsoft.Diagnostics.Tracing.Etlx.TraceLog eventLog,
            Microsoft.Diagnostics.Tracing.Etlx.TraceProcess process = null,
            Predicate <TraceEvent> predicate = null)
        {
            Microsoft.Diagnostics.Tracing.Etlx.TraceEvents events;

            if (process == null)
            {
                events = eventLog.Events.Filter((x) => ((predicate == null) || predicate(x)) && x is SampledProfileTraceData && x.ProcessID != 0);
            }
            else
            {
                events = process.EventsInProcess.Filter((x) => ((predicate == null) || predicate(x)) && x is SampledProfileTraceData);
            }

            var traceStackSource = new TraceEventStackSource(events);

            traceStackSource.ShowUnknownAddresses = true;

            // Clone the samples so that the caller doesn't have to go back to the ETL file from here on.
            return(CopyStackSource.Clone(traceStackSource));
        }