Represents a configuration child.
Пример #1
0
 public void Intercept(IInvocation invocation) {
     if (currentElement.Value.Value != null)
         currentElement.Value.Value.Stop();
     var sw = new Stopwatch();
     var newChild = currentElement.AddChild(KV.Create(invocation.MethodInvocationTarget, sw));
     currentElement = newChild;
     sw.Start();
     try {
         invocation.Proceed();
     } finally {
         sw.Stop();
         currentElement = currentElement.Parent;
         if (currentElement.Value.Value != null)
             currentElement.Value.Value.Start();
     }
 }
Пример #2
0
		internal CompoundChild(String name, Node[] childNodes)
			: base(name)
		{
			this.childNodes = childNodes;
		}
Пример #3
0
 public Node<KeyValuePair<MethodInfo, TimeSpan>> GetProfile()
 {
     var node = new Node<KeyValuePair<MethodInfo, TimeSpan>>(null, new KeyValuePair<MethodInfo, TimeSpan>(null, new TimeSpan()));
     node.Children.AddRange(currentElement.Children.Select(c => GetProfile(c, node)));
     return node;
 }
Пример #4
0
 public void Clear()
 {
     currentElement = new Node<KeyValuePair<MethodInfo, Stopwatch>>(null, new KeyValuePair<MethodInfo, Stopwatch>(null, null));
 }
Пример #5
0
 private Node<KeyValuePair<MethodInfo, TimeSpan>> GetProfile(Node<KeyValuePair<MethodInfo, Stopwatch>> n, Node<KeyValuePair<MethodInfo, TimeSpan>> parent)
 {
     var node = new Node<KeyValuePair<MethodInfo, TimeSpan>>(parent, KV.Create(n.Value.Key, n.Value.Value.Elapsed));
     node.Children.AddRange(n.Children.Select(c => GetProfile(c, node)));
     return node;
 }