Ejemplo n.º 1
0
        public void StartTrace()
        {
            MethodBase   methodBase      = new StackTrace().GetFrame(1).GetMethod();
            MethodTracer methodTracer    = new MethodTracer(methodBase.ReflectedType.Name, methodBase.Name);
            ThreadTracer curThreadTracer = AddOrGetThreadTracer(Thread.CurrentThread.ManagedThreadId);

            curThreadTracer.StartTraceMethod(methodTracer);
        }
Ejemplo n.º 2
0
 private ThreadTracer AddOrGetThreadTracer(int id)
 {
     lock (_locker)
     {
         if (!_threadTracers.TryGetValue(id, out ThreadTracer threadTracer))
         {
             threadTracer       = new ThreadTracer(id);
             _threadTracers[id] = threadTracer;
         }
         return(threadTracer);
     }
 }
        static internal ThreadTracerResult GetResult(ThreadTracer threadTracer)
        {
            ThreadTracerResult result = new ThreadTracerResult();

            result.ExtremeMethodResults = new List <MethodTracerResult>();
            foreach (var extremeMethod in threadTracer.ExtremeMethods)
            {
                result.ExtremeMethodResults.Add(MethodTracerResult.GetResult(extremeMethod));
            }
            result.ThreadId    = threadTracer.ThreadId;
            result.TimeElapsed = threadTracer.TimeElapsed;
            return(result);
        }
Ejemplo n.º 4
0
        internal void Start(int id, MethodBase method)
        {
            ThreadTracer threadTracer = dictionary.GetOrAdd(id, new ThreadTracer());

            threadTracer.AddMethod(method);
        }