public static void Reset() { _currentStack = null; _rootNode = null; if (AW2.Core.AssaultWingCore.Instance == null || !AW2.Core.AssaultWingCore.Instance.Settings.Net.HeavyProfileLog) return; _currentStack = new Stack<ScopeTreeNode>(); _rootNode = new ScopeTreeNode("ROOT"); _currentStack.Push(_rootNode); }
private static void CollectPerTagInfo(ScopeTreeNode node, Dictionary<string, Counter> perTagInfo) { if (node.Name != null) { if (perTagInfo.ContainsKey(node.Name)) { perTagInfo[node.Name].Add(node.TotalBytes); } else { var c = new Counter(); c.Add(node.TotalBytes); perTagInfo.Add(node.Name, c); } } foreach (var child in node.Children) CollectPerTagInfo(child, perTagInfo); }
public ScopeTreeNode GetChild(string name) { var item = Children.FirstOrDefault(child => child.Name == name); if (item != null) return item; var newNode = new ScopeTreeNode(name); Children.Add(newNode); return newNode; }
private static void Dump(ScopeTreeNode node, StreamWriter writer, int depth) { for (int i = 0; i < depth; i++) writer.Write(" "); node.Sort(); if (node.Name != null) writer.WriteLine(node.Name + " (" + node.TotalBytes + ")"); foreach (ScopeTreeNode child in node.Children) Dump(child, writer, depth + 1); }