File tree Expand file tree Collapse file tree 5 files changed +27
-17
lines changed
Framework/PostSharp.Samples.Profiling Expand file tree Collapse file tree 5 files changed +27
-17
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Linq ;
3+
4+ namespace PostSharp . Samples . Profiling
5+ {
6+ internal struct ExcludedTimeData
7+ {
8+ public long CpuTime ;
9+ public long ThreadTime ;
10+
11+ public ExcludedTimeData ( long cpuTime , long threadTime )
12+ {
13+ this . CpuTime = cpuTime ;
14+ this . ThreadTime = threadTime ;
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ namespace PostSharp.Samples.Profiling
55{
66 public struct MethodCallData
77 {
8-
98 internal MetricData MetricData ;
109
1110 private long _kernelTimestamp ;
@@ -23,7 +22,7 @@ internal void Start(MetricMetadata metadata)
2322 this . Resume ( ) ;
2423 }
2524
26- public bool IsNull => this . _asyncTimestamp == 0 ;
25+ internal bool IsNull => this . _asyncTimestamp == 0 ;
2726
2827 internal MetricMetadata Metadata { get ; private set ; }
2928
Original file line number Diff line number Diff line change 66
77namespace PostSharp . Samples . Profiling
88{
9- internal struct ExcludedTimeData
10- {
11- public long CpuTime ;
12- public long ThreadTime ;
13-
14- public ExcludedTimeData ( long cpuTime , long threadTime )
15- {
16- this . CpuTime = cpuTime ;
17- this . ThreadTime = threadTime ;
18- }
19- }
20-
219 internal struct MetricData
2210 {
2311 public long CpuTime ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -14,14 +14,20 @@ internal class Program
1414 static volatile bool cancel ;
1515 private static void Main ( string [ ] args )
1616 {
17- TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration ( "4fe9fc01-23cc-40ee-94e1-6dc532d861b9" ) ;
17+ // TODO: Add your own instrumentation key.
18+ const string instrumentationKey = "4fe9fc01-23cc-40ee-94e1-6dc532d861b9" ;
19+
20+ TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration ( instrumentationKey ) ;
1821 TelemetryClient telemetryClient = new TelemetryClient ( telemetryConfiguration ) ;
1922 if ( ! telemetryClient . IsEnabled ( ) )
2023 {
2124 Console . Write ( "TelemetryClient is not enabled." ) ;
2225 return ;
2326 }
24- ProfilingServices . Initialize ( telemetryClient , TimeSpan . FromSeconds ( 10 ) ) ;
27+ TimeSpan period = TimeSpan . FromSeconds ( 10 ) ;
28+ ProfilingServices . Initialize ( telemetryClient , ) ;
29+
30+ Console . WriteLine ( $ "Sampling every { period . TotalSeconds } seconds. Press Ctrl-C to stop, then wait a few seconds for completion.") ;
2531
2632 Console . CancelKeyPress += OnCancel ;
2733
@@ -44,7 +50,7 @@ private static void Main(string[] args)
4450
4551 private static void OnCancel ( object sender , ConsoleCancelEventArgs e )
4652 {
47- Console . WriteLine ( "Cancelling." ) ;
53+ Console . WriteLine ( "Cancelling. Please wait until completion, otherwise the Application Insights buffer won't be flushed. " ) ;
4854 cancel = true ;
4955 e . Cancel = true ;
5056 }
You can’t perform that action at this time.
0 commit comments