/// <summary> /// Invoked when the crawler encounters a BTree node /// </summary> /// <param name="objectId">The node id</param> /// <param name="currentDepth">The depth of the node in the BTree</param> /// <param name="keyCount">The number of keys on the node</param> /// <param name="childNodeCount">The number of child nodes on the node</param> public void OnNodeStart(ulong objectId, int currentDepth, int keyCount, int childNodeCount) { var nodeReport = new NodeReport(objectId, currentDepth, keyCount, childNodeCount); var btreeReport = _relatedResourceListReport ?? _btreeReport; if (currentDepth == 0) { btreeReport.RootNode = nodeReport; } else { if (btreeReport.Depth < (currentDepth + 1)) { btreeReport.Depth = currentDepth + 1; } _nodeReportStack.Peek().Children.Add(nodeReport); } _nodeReportStack.Push(nodeReport); }
public NodeAnalysisModel(NodeReport nodeReport) { _nodeReport = nodeReport; Label = "Node: " + NodeId; TotalKeyCount = nodeReport.KeyCount; TotalChildCount = nodeReport.ChildNodeCount; foreach(var rr in _nodeReport.RelatedResourceLists) { var btr = new BTreeAnalysisModel(rr); Children.Add(btr); } foreach(var nr in _nodeReport.Children) { var nam = new NodeAnalysisModel(nr); Children.Add(nam); TotalChildCount += nam.TotalChildCount; TotalKeyCount += nam.TotalKeyCount; } AvgKeysPerNode = (double) TotalKeyCount/(TotalChildCount + 1); }