Esempio n. 1
0
        public void StartTrace()
        {
            MethodBase   methodBase      = new StackTrace().GetFrame(1).GetMethod();
            MethodTracer methodTracer    = new MethodTracer(methodBase.ReflectedType.Name, methodBase.Name);
            ThreadTracer curThreadTracer = AddOrGetThreadTracer(Thread.CurrentThread.ManagedThreadId);

            curThreadTracer.StartTraceMethod(methodTracer);
        }
Esempio n. 2
0
 internal void StartTraceMethod(MethodTracer methodTracer)
 {
     if (_unstopped.Count > 0)
     {
         MethodTracer lastUnstoppedMethodTracer = _unstopped.Peek();
         lastUnstoppedMethodTracer.Inner.Add(methodTracer);
     }
     methodTracer.StartTrace();
     _unstopped.Push(methodTracer);
 }
Esempio n. 3
0
        internal void StopTraceMethod()
        {
            MethodTracer lastStopped = _unstopped.Pop(); //rewrite with unstopped.peek().StopTrace() ?

            lastStopped.StopTrace();
            if (!_unstopped.Any())
            {
                ExtremeMethods.Add(lastStopped);
                TimeElapsed += lastStopped.ElapsedTime;
            }
        }
Esempio n. 4
0
        static internal MethodTracerResult GetResult(MethodTracer methodTracer)
        {
            MethodTracerResult result = new MethodTracerResult();

            result.ClassName   = methodTracer.ClassName;
            result.MethodName  = methodTracer.MethodName;
            result.ElapsedTime = methodTracer.ElapsedTime;
            result.Inner       = new List <MethodTracerResult>();
            foreach (var innerMethodTracer in methodTracer.Inner)
            {
                result.Inner.Add(MethodTracerResult.GetResult(innerMethodTracer));
            }

            return(result);
        }