Esempio n. 1
0
 Profiler()
 {
     _current   = new ProfileItem("");
     _stopwatch = new Stopwatch();
     _current.Start(_stopwatch.Elapsed);
     _stopwatch.Start();
 }
Esempio n. 2
0
 void AfterAction()
 {
     lock (this)
     {
         _stopwatch.Stop();
         var end = _stopwatch.Elapsed;
         _current.End(end);
         _current = _stack.Pop();
         _current.Resume(end);
         _stopwatch.Start();
     }
 }
Esempio n. 3
0
 void BeforeAction(string flag, int stackFrameDepth)
 {
     lock (this)
     {
         _stopwatch.Stop();
         var start = _stopwatch.Elapsed;
         _current.Suspend(start);
         _stack.Push(_current);
         var position = Tracer.MethodHeader(stackFrameDepth: stackFrameDepth + 1) + flag;
         if (!_profileItems.TryGetValue(position, out _current))
         {
             _current = new ProfileItem(position);
             _profileItems.Add(position, _current);
         }
         _current.Start(start);
         _stopwatch.Start();
     }
 }
Esempio n. 4
0
 void Start(string flag, int stackFrameDepth)
 {
     _instance.BeforeAction(flag, stackFrameDepth + 1);
     _item = _profiler._current;
 }