Example #1
0
        public void StartTrace()
        {
            if (CurrentMethodTracer != null)
            {
                CurrentMethodTracer.StopTrace();
                MethodTracers.Push(CurrentMethodTracer);
            }
            CurrentMethodTracer = new MethodTracer();

            CurrentMethodTracer.StartTrace();
        }
Example #2
0
        public void StopTrace()
        {
            MethodTracer lastUnstoppedMethodTracer = sUnstoppedMethodTracers.Pop();

            lastUnstoppedMethodTracer.StopTrace();
            if (!sUnstoppedMethodTracers.Any())
            {
                lFirstLvlMethodTracers.Add(lastUnstoppedMethodTracer);
                Time += lastUnstoppedMethodTracer.Time;
            }
        }
Example #3
0
        public void StopTrace()
        {
            CurrentMethodTracer.StopTrace();
            StackTrace        stackTrace          = new StackTrace();
            string            methodName          = stackTrace.GetFrame(2).GetMethod().Name;
            string            className           = stackTrace.GetFrame(2).GetMethod().ReflectedType.Name;
            double            methodExecutionTime = CurrentMethodTracer.GetExecutionTime();
            List <MethodInfo> methodInfos         = CurrentMethodTracer.GetChildMethods();
            MethodInfo        methodInfo          = new MethodInfo(methodName, className, methodExecutionTime, methodInfos);

            if (MethodTracers.Count > 0)
            {
                CurrentMethodTracer = MethodTracers.Pop();
                CurrentMethodTracer.AddChildMethod(methodInfo);
            }
            else
            {
                MethodInfoList.Add(methodInfo);
                CurrentMethodTracer = null;
            }
        }