예제 #1
0
        public void StopTrace()
        {
            int           id     = Thread.CurrentThread.ManagedThreadId;
            ThreadDetails thread = new ThreadDetails(id);

            RemoveMethodFromTracerDictionary(id, thread);
        }
예제 #2
0
 private void RemoveMethodFromTracerDictionary(int id, ThreadDetails thread)
 {
     if (_threads.ContainsKey(id))
     {
         _threads.TryGetValue(id, out thread);
         thread.StopTraceMethod();
     }
 }
예제 #3
0
        public void StartTrace()
        {
            StackTrace    st         = new StackTrace(true);
            MethodBase    methodBase = st.GetFrame(1).GetMethod();
            string        methodName = methodBase.Name;
            string        className  = methodBase.ReflectedType.Name;
            Method        method     = new Method(methodName, className);
            int           id         = Thread.CurrentThread.ManagedThreadId;
            ThreadDetails thread     = new ThreadDetails(id);

            AddMethodToTracerDictionary(id, thread, method);
        }
예제 #4
0
 private void AddMethodToTracerDictionary(int id, ThreadDetails thread, Method method)
 {
     if (_threads.ContainsKey(id))
     {
         _threads.TryGetValue(id, out thread);
         thread.StartTraceMethod(method);
     }
     else
     {
         thread.StartTraceMethod(method);
         _threads.TryAdd(id, thread);
     }
 }