public void StartTrace() { ThreadTracer threadTracer = GetCurrentThreadTracer(); if (threadTracer == null) { int currentThreadId = Thread.CurrentThread.ManagedThreadId; threadTracer = new ThreadTracer(); ThreadTracers.TryAdd(currentThreadId, threadTracer); } threadTracer.StartTrace(); }
private ThreadTracer AddOrGetThreadTracer(int id) { lock (locker) { if (!cdThreadTracers.TryGetValue(id, out ThreadTracer threadTracer)) { threadTracer = new ThreadTracer(id); cdThreadTracers[id] = threadTracer; } return(threadTracer); } }
public void StartTrace() { ThreadTracer threadTracer = GetCurrentThreadTracer(); if (threadTracer == null) { int currentThreadId = Thread.CurrentThread.ManagedThreadId; threadTracer = new ThreadTracer(currentThreadId); lock (Locker) { ThreadTracers.Add(threadTracer); } } threadTracer.StartTrace(); }
public static ThreadTracerResult GetTraceResult(ThreadTracer threadTracer) { ThreadTracerResult threadTracerResult = new ThreadTracerResult(); threadTracerResult.lFirstLvlMethodTracersResult = new List <MethodTracerResult>(); threadTracerResult.Id = threadTracer.Id; threadTracerResult.Time = threadTracer.Time; foreach (var firstLvlMethodTracer in threadTracer.lFirstLvlMethodTracers) { threadTracerResult.lFirstLvlMethodTracersResult.Add(MethodTracerResult.GetTraceResult(firstLvlMethodTracer)); } return(threadTracerResult); }
public void StopTrace() { ThreadTracer threadTracer = GetCurrentThreadTracer(); threadTracer.StopTrace(); int currentThreadId = Thread.CurrentThread.ManagedThreadId; ThreadInfo threadInfo = GetThreadInfoById(currentThreadId); if (threadInfo == null) { List <MethodInfo> threadMethodInfos = threadTracer.GetThreadMethodList(); threadInfo = new ThreadInfo(currentThreadId, threadMethodInfos); lock (Locker) { ThreadsInfo.Add(threadInfo); } } }
public void StopTrace() { ThreadTracer threadTracer = GetCurrentThreadTracer(); threadTracer.StopTrace(); }
public void StopTrace() { ThreadTracer currThreadTracer = AddOrGetThreadTracer(Thread.CurrentThread.ManagedThreadId); currThreadTracer.StopTrace(); }