private void AddIndex(TreeReport report, int pageSize, bool includeDetails) { Indexes.Add(report); var allocatedSpaceInBytes = report.PageCount * pageSize; AllocatedSpaceInBytes += allocatedSpaceInBytes; if (includeDetails) { UsedSizeInBytes += (long)(allocatedSpaceInBytes * report.Density); } }
private void AddIndex(TreeReport report, int pageSize, bool calculateExactSizes) { Indexes.Add(report); var allocatedSpaceInBytes = report.PageCount * pageSize; AllocatedSpaceInBytes += allocatedSpaceInBytes; if (calculateExactSizes) { UsedSizeInBytes += (long)(allocatedSpaceInBytes * report.Density); } }
public override DetailedStorageReport GenerateStorageReport(bool calculateExactSizes) { TransactionOperationContext context; using (_contextPool.AllocateOperationContext(out context)) using (var tx = context.OpenReadTransaction()) { var report = _indexStorage.Environment().GenerateDetailedReport(tx.InnerTransaction, calculateExactSizes); var treesToKeep = new List <TreeReport>(); TreeReport aggregatedTree = null; var numberOfReduceTrees = 0; foreach (var treeReport in report.Trees) { if (treeReport.Name.StartsWith(MapReduceResultsStore.ReduceTreePrefix) == false) { treesToKeep.Add(treeReport); continue; } numberOfReduceTrees++; if (aggregatedTree == null) { aggregatedTree = new TreeReport(); } aggregatedTree.AllocatedSpaceInBytes += treeReport.AllocatedSpaceInBytes; aggregatedTree.BranchPages += treeReport.BranchPages; aggregatedTree.Density = calculateExactSizes ? aggregatedTree.Density + treeReport.Density : -1; aggregatedTree.Depth = Math.Max(aggregatedTree.Depth, treeReport.Depth); aggregatedTree.LeafPages += treeReport.LeafPages; aggregatedTree.NumberOfEntries += treeReport.NumberOfEntries; aggregatedTree.OverflowPages += treeReport.OverflowPages; aggregatedTree.PageCount += treeReport.PageCount; aggregatedTree.Type = treeReport.Type; aggregatedTree.UsedSpaceInBytes = calculateExactSizes ? aggregatedTree.UsedSpaceInBytes + treeReport.UsedSpaceInBytes : -1; } if (aggregatedTree != null) { aggregatedTree.Name = $"Reduce Trees (#{numberOfReduceTrees})"; treesToKeep.Add(aggregatedTree); } report.Trees = treesToKeep; return(report); } }