コード例 #1
0
        public void StartTrace()
        {
            ThreadTracer threadTracer = GetCurrentThreadTracer();

            if (threadTracer == null)
            {
                int currentThreadId = Thread.CurrentThread.ManagedThreadId;
                threadTracer = new ThreadTracer();
                ThreadTracers.TryAdd(currentThreadId, threadTracer);
            }
            threadTracer.StartTrace();
        }
コード例 #2
0
ファイル: Tracer.cs プロジェクト: larvailor/Tracer
 private ThreadTracer AddOrGetThreadTracer(int id)
 {
     lock (locker)
     {
         if (!cdThreadTracers.TryGetValue(id, out ThreadTracer threadTracer))
         {
             threadTracer        = new ThreadTracer(id);
             cdThreadTracers[id] = threadTracer;
         }
         return(threadTracer);
     }
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
        public void StopTrace()
        {
            ThreadTracer threadTracer = GetCurrentThreadTracer();

            threadTracer.StopTrace();
        }
コード例 #7
0
ファイル: Tracer.cs プロジェクト: larvailor/Tracer
        public void StopTrace()
        {
            ThreadTracer currThreadTracer = AddOrGetThreadTracer(Thread.CurrentThread.ManagedThreadId);

            currThreadTracer.StopTrace();
        }