public StorageReport GenerateReport(Transaction tx) { var numberOfAllocatedPages = Math.Max(_dataPager.NumberOfAllocatedPages, NextPageNumber - 1); // async apply to data file task var numberOfFreePages = _freeSpaceHandling.AllPages(tx.LowLevelTransaction).Count; var countOfTrees = 0; var countOfTables = 0; using (var rootIterator = tx.LowLevelTransaction.RootObjects.Iterate(false)) { if (rootIterator.Seek(Slices.BeforeAllKeys)) { do { var currentKey = rootIterator.CurrentKey.Clone(tx.Allocator); var type = tx.GetRootObjectType(currentKey); switch (type) { case RootObjectType.VariableSizeTree: countOfTrees++; break; case RootObjectType.EmbeddedFixedSizeTree: break; case RootObjectType.FixedSizeTree: countOfTrees++; break; case RootObjectType.Table: countOfTables++; break; default: throw new ArgumentOutOfRangeException(); } }while (rootIterator.MoveNext()); } } var generator = new StorageReportGenerator(tx.LowLevelTransaction); return(generator.Generate(new ReportInput { NumberOfAllocatedPages = numberOfAllocatedPages, NumberOfFreePages = numberOfFreePages, NextPageNumber = NextPageNumber, CountOfTrees = countOfTrees, CountOfTables = countOfTables, Journals = Journal.Files.ToList() })); }
public Dictionary <string, List <long> > AllPages(Transaction tx) { var results = new Dictionary <string, List <long> >(StringComparer.OrdinalIgnoreCase) { { "Root", State.Root.AllPages(tx) }, { "Free Space Overhead", State.FreeSpaceRoot.AllPages(tx) }, { "Free Pages", _freeSpaceHandling.AllPages(tx) } }; foreach (var tree in tx.Trees) { results.Add(tree.Name, tree.AllPages(tx)); } return(results); }