Beispiel #1
0
        public void StartMethodTrace(MethodTrace method)
        {
            int currentThreadID = Thread.CurrentThread.ManagedThreadId;

            ThreadTrace currentThreadTrace;

            if (threads.TryGetValue(currentThreadID, out currentThreadTrace))
            {
                currentThreadTrace.StartMethodTrace(method);
            }
            else
            {
                ThreadTrace newThreadTrace = new ThreadTrace(currentThreadID);
                if (threads.TryAdd(currentThreadID, newThreadTrace))
                {
                    newThreadTrace.StartMethodTrace(method);
                }
                else
                {
                    throw new Exception("Error occured while trying to add thread");
                }
            }
        }
Beispiel #2
0
 public Thread(ThreadTrace currentThreadTrace)
 {
     Id      = currentThreadTrace.Id;
     Time    = currentThreadTrace.TotalExecutionTime;
     Methods = Method.formMethodsArray(currentThreadTrace.Methods.ToArray());
 }