public void StopTrace() { ThreadResult currThread = traceResult.GetCurrThread(Thread.CurrentThread.ManagedThreadId); MethodResult method = currThread.PopCurrMethod(); method.StopTiming(); }
public TraceResult GetTraceResult() { TraceResult tr = new TraceResult(); tr.threads = new List <ThreadResult>(); foreach (int index in dict.Keys) { ThreadResult thrres = new ThreadResult(); thrres.threadId = index; thrres.methods = dict[index].children; thrres.CalculateTime(); tr.Add(thrres); } return(tr); }
protected internal ThreadResult DeepCopy() { ThreadResult threadCopy = new ThreadResult { id = id, time = time, methods = new List <MethodResult>() }; foreach (MethodResult innerMethod in methods) { threadCopy.methods.Add(innerMethod.DeepCopy()); } return(threadCopy); }
public void StartTrace() { ThreadResult currThread = traceResult.SetCurrThread(Thread.CurrentThread.ManagedThreadId); MethodBase methodBase = new StackTrace(1).GetFrame(0).GetMethod(); var method = new MethodResult(methodBase); if (currThread.IsFirstLevelMethod()) { currThread.AddMethod(method); } else { currThread.GetCurrMethod().AddMethod(method); } currThread.AddDepthMethod(method); method.StartTiming(); }
public void StartTrace() { int threadId = Thread.CurrentThread.ManagedThreadId; if (!threadResults.ContainsKey(threadId)) { var threadResult = new ThreadResult(); threadResults.TryAdd(threadId, threadResult); } var stackTrace = new StackTrace(); MethodBase tracedMethod = stackTrace.GetFrame(1).GetMethod(); var temp = new TraceResult(tracedMethod.Name, tracedMethod.DeclaringType.Name); threadResults[threadId].AddTraceResult(temp); var stopwatch = new Stopwatch(); stopwatches.TryAdd(tracedMethod.GetHashCode(), stopwatch); stopwatch.Start(); }
internal void Add(ThreadResult threadResult) { threads.Add(threadResult); }