public void StopTrace() { ThreadTracer threadTracer = GetCurrentThreadTracer(); threadTracer.StopTrace(); int currentThreadId = Thread.CurrentThread.ManagedThreadId; ThreadInformation threadInfo = GetThreadInfoById(currentThreadId); if (threadInfo == null) { List <MethodInformation> threadMethodInfos = threadTracer.GetThreadMethodList(); threadInfo = new ThreadInformation(currentThreadId, threadMethodInfos); _threadsInfo.TryAdd(currentThreadId, threadInfo); } }
private XElement GetThreadXElement(ThreadInformation threadInfo) { XElement threadXElement = new XElement( "thread", new XAttribute("id", threadInfo.Id), new XAttribute("time", threadInfo.ExecutionTime) ); foreach (MethodInformation method in threadInfo.Methods) { XElement methodXElement = GetMethodXElementWithChildMethods(method); threadXElement.Add(methodXElement); } return(threadXElement); }
private JObject GetThreadJObject(ThreadInformation threadInfo) { JArray methodJArray = new JArray(); foreach (MethodInformation method in threadInfo.Methods) { JObject methodJObject = GetMethodJObjectWithChildMethods(method); methodJArray.Add(methodJObject); } return(new JObject { { "id", threadInfo.Id }, { "time", threadInfo.ExecutionTime }, { "methods", methodJArray } }); }