예제 #1
0
 public ProfiledSection(IProfilerSink profilerSink, TimeStatistics timeStatistics)
 {
     this.profilerSink   = profilerSink;
     this.timeStatistics = timeStatistics;
     TracingAnalyzer.ClearStatsForCurrentThread();
     stopwatch = Stopwatch.StartNew();
 }
예제 #2
0
 public void Dispose()
 {
     stopwatch.Stop();
     if (timeStatistics.RegisterDuration(stopwatch.ElapsedMilliseconds))
     {
         var stats = TracingAnalyzer.GetStatsForCurrentThread();
         var trace = TracingAnalyzerStatsFormatter.Format(stats, stopwatch.ElapsedMilliseconds);
         profilerSink.WhenCurrentDurationIsLongerThanPercentile99(stopwatch.Elapsed, timeStatistics, trace);
     }
 }