Esempio n. 1
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);
        }
Esempio n. 2
0
        private void TrySaveTraceResults(TracingThreadInfo tracingThreadInfo, MethodBase parentMethod, long endTime)
        {
            if ((tracingThreadInfo.TracingStack.Count == 0) || (tracingThreadInfo.TracingStack.Peek().MethodBase != parentMethod))
            {
                throw new OrderViolationException();
            }

            TracingMethodInfo tracingMethodInfo = tracingThreadInfo.TracingStack.Pop();

            tracingMethodInfo.MethodTraceResult.Time = (int)(endTime - tracingMethodInfo.StartTime);
            if (tracingThreadInfo.TracingStack.Count == 0)
            {
                tracingThreadInfo.ThreadTraceResult.Methods.Add(tracingMethodInfo.MethodTraceResult);
                tracingThreadInfo.IsEmptyThread = false;

                isThreadResultCreated = false;
            }
        }