Ejemplo n.º 1
0
 private XElement GetMethodXElement(MethodInformation methodInfo)
 {
     return(new XElement(
                "method",
                new XAttribute("name", methodInfo.Name),
                new XAttribute("class", methodInfo.ClassName),
                new XAttribute("time", methodInfo.ExecutionTime)
                ));
 }
Ejemplo n.º 2
0
 private JObject GetMethodJObject(MethodInformation methodInfo)
 {
     return(new JObject
     {
         { "name", methodInfo.Name },
         { "class", methodInfo.ClassName },
         { "time", methodInfo.ExecutionTime },
     });
 }
Ejemplo n.º 3
0
        private XElement GetMethodXElementWithChildMethods(MethodInformation methodInfo)
        {
            XElement methodXElement = GetMethodXElement(methodInfo);

            foreach (MethodInformation method in methodInfo.ChildMethods)
            {
                XElement childMethod = GetMethodXElement(method);
                if (method.ChildMethods.Count > 0)
                {
                    childMethod = GetMethodXElementWithChildMethods(method);
                }
                methodXElement.Add(childMethod);
            }
            return(methodXElement);
        }
Ejemplo n.º 4
0
        private JObject GetMethodJObjectWithChildMethods(MethodInformation methodInfo)
        {
            JObject methodJObject = GetMethodJObject(methodInfo);
            JArray  methodsJArray = new JArray();

            foreach (MethodInformation method in methodInfo.ChildMethods)
            {
                JObject childMethodJObject = GetMethodJObject(method);
                if (method.ChildMethods.Count > 0)
                {
                    childMethodJObject = GetMethodJObjectWithChildMethods(method);
                }
                methodsJArray.Add(childMethodJObject);
            }
            methodJObject.Add("methods", methodsJArray);
            return(methodJObject);
        }
Ejemplo n.º 5
0
        public void StopTrace()
        {
            _currentMethodTracer.StopTrace();
            StackTrace stackTrace                = new StackTrace();
            MethodBase method                    = stackTrace.GetFrame(2).GetMethod();
            string     methodName                = method.Name;
            string     className                 = method.ReflectedType.Name;
            double     methodExecutionTime       = _currentMethodTracer.GetExecutionTime();
            List <MethodInformation> methodInfos = _currentMethodTracer.GetChildMethods();
            MethodInformation        methodInfo  = new MethodInformation(methodName, className, methodExecutionTime, methodInfos);

            if (_methodTracers.Count > 0)
            {
                _currentMethodTracer = _methodTracers.Pop();
                _currentMethodTracer.AddChildMethod(methodInfo);
            }
            else
            {
                _methodInfoList.Add(methodInfo);
                _currentMethodTracer = null;
            }
        }
Ejemplo n.º 6
0
 public void AddChildMethod(MethodInformation childMethod)
 {
     _childMethods.Add(childMethod);
 }