1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . ComponentModel ;
4+ using System . Diagnostics ;
5+ using System . IO ;
6+ using System . IO . Compression ;
7+ using System . Linq ;
8+ using System . Text . RegularExpressions ;
9+ using System . Threading ;
10+ using System . Windows ;
11+ using System . Windows . Media ;
12+ using System . Xml ;
113using Diagnostics . Tracing . StackSources ;
214using global ::DiagnosticsHub . Packaging . Interop ;
315using Graphs ;
2234using PerfView . GuiUtilities ;
2335using PerfViewExtensibility ;
2436using PerfViewModel ;
25- using System ;
26- using System . Collections . Generic ;
27- using System . ComponentModel ;
28- using System . Diagnostics ;
29- using System . IO ;
30- using System . IO . Compression ;
31- using System . Linq ;
32- using System . Text ;
33- using System . Text . RegularExpressions ;
34- using System . Threading ;
35- using System . Windows ;
36- using System . Windows . Media ;
37- using System . Xml ;
3837using Utilities ;
3938using Address = System . UInt64 ;
4039using EventSource = EventSources . EventSource ;
@@ -724,7 +723,7 @@ protected virtual Action<Action> OpenImpl(Window parentWindow, StatusBar worker)
724723
725724 protected internal virtual void ConfigureStackWindow ( string stackSourceName , StackWindow stackWindow ) { }
726725 /// <summary>
727- /// Allows you to do a firt action after everything is done.
726+ /// Allows you to do a first action after everything is done.
728727 /// </summary>
729728 protected internal virtual void FirstAction ( StackWindow stackWindow ) { }
730729 protected internal virtual StackSource OpenStackSourceImpl (
@@ -735,7 +734,6 @@ protected internal virtual StackSource OpenStackSourceImpl(
735734 /// <summary>
736735 /// Simplified form, you should implement one overload or the other.
737736 /// </summary>
738- /// <returns></returns>
739737 protected internal virtual StackSource OpenStackSourceImpl ( TextWriter log ) { return null ; }
740738 protected internal virtual EventSource OpenEventSourceImpl ( TextWriter log ) { return null ; }
741739
@@ -5098,6 +5096,35 @@ protected internal override StackSource OpenStackSourceImpl(string streamName, T
50985096 eventSource . Kernel . AddCallbackForEvents < ObjectDuplicateHandleTraceData > ( data => onHandleEvent ( data . ObjectTypeName , data . Object , data . TargetHandle , data . TargetProcessID , data ) ) ;
50995097 eventSource . Process ( ) ;
51005098 }
5099+ else if ( streamName . StartsWith ( "Processor" ) )
5100+ {
5101+ eventSource . AllEvents += delegate ( TraceEvent data )
5102+ {
5103+ StackSourceCallStackIndex stackIndex ;
5104+ var callStackIdx = data . CallStackIndex ( ) ;
5105+ if ( callStackIdx == CallStackIndex . Invalid )
5106+ {
5107+ return ;
5108+ }
5109+
5110+ stackIndex = stackSource . GetCallStack ( callStackIdx , data ) ;
5111+
5112+ var asSampledProfile = data as SampledProfileTraceData ;
5113+ if ( asSampledProfile != null )
5114+ {
5115+ stackIndex = stackSource . Interner . CallStackIntern ( stackSource . Interner . FrameIntern ( "Priority (" + asSampledProfile . Priority + ")" ) , stackIndex ) ;
5116+ stackIndex = stackSource . Interner . CallStackIntern ( stackSource . Interner . FrameIntern ( "Processor (" + asSampledProfile . ProcessorNumber + ")" ) , stackIndex ) ;
5117+ // var processorPriority = "Processor (" + asSampledProfile.ProcessorNumber + ") Priority (" + asSampledProfile.Priority + ")";
5118+ // stackIndex = stackSource.Interner.CallStackIntern(stackSource.Interner.FrameIntern(processorPriority), stackIndex);
5119+
5120+ sample . StackIndex = stackIndex ;
5121+ sample . TimeRelativeMSec = data . TimeStampRelativeMSec ;
5122+ sample . Metric = 1 ;
5123+ stackSource . AddSample ( sample ) ;
5124+ }
5125+ } ;
5126+ eventSource . Process ( ) ;
5127+ }
51015128 else if ( streamName . StartsWith ( "Any" ) )
51025129 {
51035130 ActivityComputer activityComputer = null ;
@@ -5834,7 +5861,7 @@ protected internal override StackSource OpenStackSourceImpl(string streamName, T
58345861 sample . Metric = data . AllocSize ;
58355862 sample . StackIndex = stackSource . GetCallStack ( callStackIndex , data ) ;
58365863
5837- // Add the 'Alloc < XXX' psuedo node.
5864+ // Add the 'Alloc < XXX' pseudo node.
58385865 var nodeIndex = stackSource . Interner . FrameIntern ( GetAllocName ( ( uint ) data . AllocSize ) ) ;
58395866 sample . StackIndex = stackSource . Interner . CallStackIntern ( nodeIndex , sample . StackIndex ) ;
58405867
@@ -7048,6 +7075,7 @@ protected override Action<Action> OpenImpl(Window parentWindow, StatusBar worker
70487075 {
70497076 advanced . Children . Add ( new PerfViewStackSource ( this , "CPU (with Optimization Tiers)" ) ) ;
70507077 }
7078+ advanced . Children . Add ( new PerfViewStackSource ( this , "Processor" ) ) ;
70517079 }
70527080
70537081 if ( hasCSwitchStacks )
@@ -7258,7 +7286,7 @@ protected override Action<Action> OpenImpl(Window parentWindow, StatusBar worker
72587286 m_Children . Add ( obsolete ) ;
72597287 }
72607288
7261- if ( AppLog . InternalUser && 0 < experimental . Children . Count )
7289+ if ( AppLog . InternalUser && 0 < experimental . Children . Count )
72627290 {
72637291 m_Children . Add ( experimental ) ;
72647292 }
0 commit comments