Пример #1
0
 public static void EnteringMethod(string methodName)
 {
     if (!shouldProfile) return;
     try
     {
     //                Debug.WriteLine("Entering " + methodName);
         DateTime startTime = DateTime.Now;
         Call parent = Parent();
         var call = new Call(methodName, parent);
         if (parent.HasChild(call))
         {
             call = parent.GetChild(call);
         }
         else
         {
             parent.Children.Add(call);
         }
         call.IncrementCount();
         Stack.Push(call);
         call.Enter(startTime);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         throw;
     }
 }
 public ProfilerOutputWindow(Call call)
 {
     this.call = call;
     InitializeComponent();
     DataContext = call;
 }
Пример #3
0
 public static void StopProfiling()
 {
     shouldProfile = false;
     var threadRoots = new List<Call>(stacksPerThread.Values.Cast<Stack<Call>>().Select(stack => Root(stack)));
     Debug.WriteLine("Number of threads - " + threadRoots.Count);
     var root = new Call("all threads", null);
     root.Children.AddRange(threadRoots);
     ProfilerOutputWindow = new ProfilerOutputWindow(root);
     ProfilerOutputWindow.Show();
 }
Пример #4
0
 public Call(string methodName, Call parent)
 {
     this.methodName = methodName;
     this.parent = parent;
 }
Пример #5
0
 private int Comparison(Call x, Call y)
 {
     return y.Duration.CompareTo(x.Duration);
 }
Пример #6
0
 public bool HasChild(Call call)
 {
     return GetChild(call) != null;
 }
Пример #7
0
 public Call GetChild(Call call)
 {
     return Children.FirstOrDefault(call1 => call1.FullName == call.FullName);
 }