Ejemplo n.º 1
0
        public void StopTrace()
        {
            int threadId = Thread.CurrentThread.ManagedThreadId;
            MethodTraceResult lastMethod = Traceresult.Threads[threadId].LastStackMethods.Pop();

            lastMethod.StopTrace();
        }
Ejemplo n.º 2
0
 public void AddChildMethod(MethodTraceResult child)
 {
     if (child != null)
     {
         this.Methods.Add(child);
     }
     else
     {
         return;
     }
 }
Ejemplo n.º 3
0
        private void AddStartTraceData(TracingThreadInfo tracingThreadInfo, MethodBase parentMethod, long startTime)
        {
            MethodTraceResult methodTraceResult = new MethodTraceResult(parentMethod.Name, parentMethod.ReflectedType.Name);
            TracingMethodInfo tracingMethodInfo = new TracingMethodInfo(startTime, parentMethod, methodTraceResult);

            if (tracingThreadInfo.TracingStack.Count != 0)
            {
                TracingMethodInfo parentTracingMethodInfo = tracingThreadInfo.TracingStack.Peek();
                if (parentTracingMethodInfo.MethodTraceResult.Methods == null)
                {
                    parentTracingMethodInfo.MethodTraceResult.Methods = new List <MethodTraceResult>();
                }
                parentTracingMethodInfo.MethodTraceResult.Methods.Add(methodTraceResult);
            }
            tracingThreadInfo.TracingStack.Push(tracingMethodInfo);
        }
Ejemplo n.º 4
0
        public void StartTrace()
        {
            Calculated = false;
            int threadId = Thread.CurrentThread.ManagedThreadId;

            var thread = Traceresult.Threads.GetOrAdd(threadId, (_) => new ThreadTraceResult((uint)threadId));

            StackTrace        Stacktrace = new StackTrace();
            MethodBase        method     = Stacktrace.GetFrame(1).GetMethod();
            MethodTraceResult Newmethod  = new MethodTraceResult(method.Name, method.ReflectedType.Name);

            Newmethod.StartTrace();

            if (thread.LastStackMethods.Count() != 0)
            {
                thread.LastStackMethods.Peek().AddChildMethod(Newmethod);
            }
            else
            {
                thread.Methods.Add(Newmethod);
            }

            thread.LastStackMethods.Push(Newmethod);
        }
Ejemplo n.º 5
0
 public TracingMethodInfo(long startTime, MethodBase methodBase, MethodTraceResult methodTraceResult)
 {
     StartTime         = startTime;
     MethodBase        = methodBase;
     MethodTraceResult = methodTraceResult;
 }