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; } }
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); }
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; }
internal StackNode(StackItem item, StackNode parent) { this.item = item; this.parent = parent; }
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); } } }
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); }
public void PushNode(StackNode node) { StackNode current = CurrentNode; if (current == null) nodes.Add (node); else current.Children.Add (node); CurrentNode = node; refilter_needed = true; }
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; }
public void AddNode(StackNode node) { nodes.Add (node); refilter_needed = true; }