public void AddMemBlock(MemBlock block) { if (BottomUp) { AddMemBlockBottomUp(block); return; } if (m_subtreeRoot != 0 && !block.DoesCallStackContainAddress(m_subtreeRoot)) { return; } int rootIndex = block.FindFirstValidSymbolIndex(); if (rootIndex < 0) { return; } Node root = m_root; if (Tagged) { root = FindRootForTag(block.m_tag); if (root == null) { root = m_root.AddTaggedChild(block.m_tag, block.m_tagCRC); } } ulong[] callStack = CallstackTab.GetCallStack(block.m_callStackCRC); Node rootNode = root.FindChildByCallAddress(callStack[rootIndex], true); IStackTracer stackTracer = MemTracerForm.ms_MainForm.StackTracer; if (rootNode == null) { IStackTracer.Symbol symbol = stackTracer.GetSymbolForAddress(callStack[rootIndex]); rootNode = root.AddChild(symbol); } Node parentNode = rootNode; for (int i = rootIndex + 1; i < callStack.Length; ++i) { ulong callAddress = callStack[i]; Node thisNode = parentNode.FindChildByCallAddress(callAddress, false); if (thisNode == null) { thisNode = parentNode.AddChild(stackTracer.GetSymbolForAddress(callAddress)); } if (i == callStack.Length - 1) { thisNode.m_allocatedSize += block.m_size; ++thisNode.m_allocatedBlocks; } parentNode = thisNode; } }
public MemTracerForm() { InitializeComponent(); m_delegateAddModuleInfo = new DelegateAddModuleInfo(this.AddModuleInfo); m_delegateOnDisconnect = new DelegateOnDisconnect(this.OnDisconnect); m_delegateAddSnapshot = new DelegateAddSnapshot(this.AddSnapshot); snapshotList1.OnCompareSnapshots = new DelegateCompareSnapshots(this.CompareSnapshots); snapshotList1.OnOverlapSnapshots = new DelegateOverlapSnapshots(this.OverlapSnapshots); snapshotList1.SetMainForm(this); snapshotInfo1.Init("Global"); m_graphLineHandle = usageGraph.AddLine(0, Color.LightGreen); ms_MainForm = this; LoadConfig(kConfigFileName); StackTracer = new DiaStackTracer(); EnableTabPage(tabPageFrameSnapshot, IsFrameAnalysisEnabled()); EnableTabPage(tabPageFrameOps, IsFrameAnalysisEnabled()); }