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(); }
internal void StopTrace() { MethodTracer lastMethod = methodsStack.Pop(); lastMethod.StopTrace(); if (methodsStack.Count == 0) { Methods.Add(lastMethod); TotalElapsedTime += lastMethod.ElapsedTime; } }
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; } }