예제 #1
0
			public void InstanceAllocated (uint size, StackItem allocator, StackNode stack)
			{
				bytes += size;
				if (allocator != null) {
					if (Allocations.ContainsKey (allocator))
						Allocations [allocator]++;
					else
						Allocations [allocator] = 1;
				}
				if (stack != null) {
					if (AllocationsByStack.ContainsKey (stack))
						AllocationsByStack [stack]++;
					else
						AllocationsByStack [stack] = 1;
				}
			}
예제 #2
0
		void EnterMethod (MethodEventInfo info)
		{
			if (info.MethodId < 0 || info.MethodId >= methods.Length)
				throw new Exception ("unknown method id");
			has_stack_data = true;
			StackItem method = methods [info.MethodId];
			StackNode node = new StackNode (method, stack.CurrentNode);
			node.start_counter = info.Counter;
			stack.PushNode (node);
		}
예제 #3
0
 void FilterNodes()
 {
     filtered_nodes.Clear ();
     items.Clear ();
     foreach (StackNode node in nodes) {
         if (node.StackItem.IsWrapper && !ShowWrappers) {
             FilterChildren (node, null, filtered_nodes, false);
         } else {
             StackNode filtered = new StackNode (node.StackItem);
             filtered.Cost = node.Cost;
             filtered_nodes.Add (filtered);
             AddNodeToItem (filtered);
             FilterChildren (node, filtered, filtered.Children, Array.IndexOf (filtered_assemblies, node.StackItem.Provider) >= 0);
         }
     }
     items.Sort (StackItem.DescendingCost);
     refilter_needed = false;
 }
예제 #4
0
파일: StackNode.cs 프로젝트: mono/emveepee
 internal StackNode(StackItem item, StackNode parent)
 {
     this.item = item;
     this.parent = parent;
 }
예제 #5
0
 void FilterChildren(StackNode node, StackNode filtered_parent, List<StackNode> result, bool filtering)
 {
     foreach (StackNode child in node.Children) {
         if ((child.StackItem.IsWrapper && !ShowWrappers) || (filtering && Array.IndexOf (filtered_assemblies, child.StackItem.Provider) >= 0)) {
             FilterChildren (child, filtered_parent, result, filtering);
         } else {
             StackNode filtered = new StackNode (child.StackItem, filtered_parent);
             filtered.Cost = child.Cost;
             result.Add (filtered);
             AddNodeToItem (filtered);
             FilterChildren (child, filtered, filtered.Children, Array.IndexOf (filtered_assemblies, child.StackItem.Provider) >= 0);
         }
     }
 }
예제 #6
0
        void AddNodeToItem(StackNode node)
        {
            StackItem item = node.StackItem;
            if (!items.Contains (item)) {
                item.Nodes.Clear ();
                item.TotalCost = 0;
                items.Add (item);
            }
            StackNode recursive_parent = node.Parent;
            while (recursive_parent != null && recursive_parent.StackItem != item)
                recursive_parent = recursive_parent.Parent;
            if (recursive_parent == null)
                item.TotalCost += node.Cost;

            item.Nodes.Add (node);
        }
예제 #7
0
 public void PushNode(StackNode node)
 {
     StackNode current = CurrentNode;
     if (current == null)
         nodes.Add (node);
     else
         current.Children.Add (node);
     CurrentNode = node;
     refilter_needed = true;
 }
예제 #8
0
 public void AddTrace(List<StackItem> items)
 {
     StackNode parent = null;
     List<StackNode> node_list = nodes;
     for (int i = 0; i < items.Count; i++) {
         StackItem curr = items [i];
         StackNode node = FindItemInList (node_list, curr);
         if (node == null) {
             node = new StackNode (curr, parent);
             node_list.Add (node);
         }
         node.Cost++;
         node.StackItem.TotalCost++;
         node_list = node.Children;
         parent = node;
     }
     refilter_needed = true;
 }
예제 #9
0
 public void AddNode(StackNode node)
 {
     nodes.Add (node);
     refilter_needed = true;
 }