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

            threadTracer.StartTrace(methodTracer);
        }
Esempio n. 2
0
 public void StartTrace()
 {
     if (_currentMethodTracer != null)
     {
         _methodTracers.Push(_currentMethodTracer);
     }
     _currentMethodTracer = new MethodTracer();
     _currentMethodTracer.StartTrace();
 }
Esempio n. 3
0
        internal void StopTrace()
        {
            if (MethodsInThread.Count == 0)
            {
                throw new InvalidOperationException("Can't stop tracing method that doesn't exist");
            }
            MethodTracer popedMethod = MethodsInThread.Pop();

            popedMethod.StopTrace();
        }
Esempio n. 4
0
        internal void StartTrace(MethodTracer method)
        {
            if (methodsStack.Count > 0)
            {
                MethodTracer lastMethod = methodsStack.Peek();
                lastMethod.Methods.Add(method);
            }

            method.StartTrace();
            methodsStack.Push(method);
        }
Esempio n. 5
0
 private void AddMethod(MethodTracer method)
 {
     if (MethodsInThread.Count > 0)
     {
         MethodsInThread.Peek().AddInnerMethod(method);
     }
     else
     {
         TracedMethods.Add(method);
     }
     MethodsInThread.Push(method);
 }
Esempio n. 6
0
        internal void StopTrace()
        {
            MethodTracer lastMethod = methodsStack.Pop();

            lastMethod.StopTrace();

            if (methodsStack.Count == 0)
            {
                Methods.Add(lastMethod);
                TotalElapsedTime += lastMethod.ElapsedTime;
            }
        }
Esempio n. 7
0
        internal MethodTracer GetTraceResult()
        {
            var result = new MethodTracer(ClassName, MethodName);

            result.ElapsedTime = ElapsedTime;

            foreach (var method in Methods)
            {
                result.Methods.Add(method.GetTraceResult());
            }

            return(result);
        }
Esempio n. 8
0
        public void StartTrace()
        {
            MethodBase   methodBase          = new StackTrace().GetFrame(1).GetMethod();
            string       methodName          = methodBase.Name;
            string       className           = methodBase.ReflectedType.Name;
            MethodTracer methodTracer        = new MethodTracer(methodName, className);
            int          threadId            = Thread.CurrentThread.ManagedThreadId;
            ThreadTracer currentThreadTracer = traceResult.GetThreadTracer(threadId);

            if (currentThreadTracer == null)
            {
                currentThreadTracer = new ThreadTracer(threadId);
                currentThreadTracer = traceResult.AddThreadTracer(threadId, currentThreadTracer);
            }
            currentThreadTracer.StartTrace(methodTracer);
        }
Esempio n. 9
0
        public void StopTrace()
        {
            _currentMethodTracer.StopTrace();
            StackTrace stackTrace                = new StackTrace();
            MethodBase method                    = stackTrace.GetFrame(2).GetMethod();
            string     methodName                = method.Name;
            string     className                 = method.ReflectedType.Name;
            double     methodExecutionTime       = _currentMethodTracer.GetExecutionTime();
            List <MethodInformation> methodInfos = _currentMethodTracer.GetChildMethods();
            MethodInformation        methodInfo  = new MethodInformation(methodName, className, methodExecutionTime, methodInfos);

            if (_methodTracers.Count > 0)
            {
                _currentMethodTracer = _methodTracers.Pop();
                _currentMethodTracer.AddChildMethod(methodInfo);
            }
            else
            {
                _methodInfoList.Add(methodInfo);
                _currentMethodTracer = null;
            }
        }
Esempio n. 10
0
 internal void StartTrace(MethodTracer method)
 {
     AddMethod(method);
     method.StartTrace();
 }
Esempio n. 11
0
 internal void AddInnerMethod(MethodTracer method)
 {
     InnerMethods.Add(method);
 }