12 private readonly uint blockSize;
13 private uint nrObjects = 0;
14 private uint nrBlocks = 0;
15 private uint nrBlobBlocks = 0;
16 private uint minObjSize = uint.MaxValue;
17 private uint maxObjSize = uint.MinValue;
18 private uint minDepth = uint.MaxValue;
19 private uint maxDepth = uint.MinValue;
20 private uint minObjPerBlock = uint.MaxValue;
21 private uint maxObjPerBlock = uint.MinValue;
22 private uint minBytesUsedPerBlock = uint.MaxValue;
23 private uint maxBytesUsedPerBlock = uint.MinValue;
24 private ulong sumObjSize = 0;
25 private ulong nrBytesUsed = 0;
26 private ulong nrBytesUnused = 0;
27 private ulong nrBytesTotal = 0;
28 private ulong nrBlobBytesUsed = 0;
29 private ulong nrBlobBytesUnused = 0;
30 private ulong nrBlobBytesTotal = 0;
31 private readonly ulong nrBlockLoads = 0;
32 private readonly ulong nrCacheLoads = 0;
33 private readonly ulong nrBlockSaves = 0;
34 private readonly ulong nrBlobBlockLoads = 0;
35 private readonly ulong nrBlobBlockSaves = 0;
36 private readonly ulong nrFullFileScans;
37 private readonly ulong nrSearches;
38 private bool isCorrupt =
false;
39 private bool isBalanced =
true;
41 private readonly
object synchObject =
new object();
42 private int[] unreferencedBlocks =
null;
43 private int[] unreferencedBlobBlocks =
null;
83 lock (this.synchObject)
97 lock (this.synchObject)
99 return this.nrBytesUsed;
111 lock (this.synchObject)
113 return this.nrBytesUnused;
125 lock (this.synchObject)
127 return this.nrBytesTotal;
139 lock (this.synchObject)
141 return this.nrBlobBlocks;
153 lock (this.synchObject)
155 return this.nrBlobBytesUsed;
167 lock (this.synchObject)
169 return this.nrBlobBytesUnused;
181 lock (this.synchObject)
183 return this.nrBlobBytesTotal;
195 lock (this.synchObject)
197 return (100.0 * (this.nrBytesUsed + this.nrBlobBytesUsed)) / (this.nrBytesTotal + this.nrBlobBytesTotal);
209 lock (this.synchObject)
211 return this.nrObjects;
223 lock (this.synchObject)
225 return this.minObjSize;
231 lock (this.synchObject)
233 this.minObjSize = value;
245 lock (this.synchObject)
247 return this.maxObjSize;
259 lock (this.synchObject)
261 return this.minObjPerBlock;
273 lock (this.synchObject)
275 return this.maxObjPerBlock;
287 lock (this.synchObject)
289 return this.minBytesUsedPerBlock;
301 lock (this.synchObject)
303 return this.maxBytesUsedPerBlock;
315 lock (this.synchObject)
317 return ((
double)this.sumObjSize) / this.nrObjects;
329 lock (this.synchObject)
331 return ((
double)this.nrObjects) / this.nrBlocks;
343 lock (this.synchObject)
345 return ((
double)this.nrBytesUsed) / this.nrBlocks;
357 lock (this.synchObject)
359 return this.minDepth;
371 lock (this.synchObject)
373 return this.maxDepth;
385 lock (this.synchObject)
387 return this.nrBlockLoads;
399 lock (this.synchObject)
401 return this.nrCacheLoads;
413 lock (this.synchObject)
415 return this.nrBlockSaves;
427 lock (this.synchObject)
429 return this.nrBlobBlockLoads;
441 lock (this.synchObject)
443 return this.nrBlobBlockSaves;
455 lock (this.synchObject)
457 return this.isCorrupt;
469 lock (this.synchObject)
471 return this.isBalanced && this.minDepth == this.maxDepth;
477 lock (this.synchObject)
479 this.isBalanced = value;
491 lock (this.synchObject)
493 if (this.comments is
null)
494 return Array.Empty<
string>();
496 return this.comments.
ToArray();
508 lock (this.synchObject)
510 return !(this.comments is
null);
520 get => this.unreferencedBlocks;
521 internal set => this.unreferencedBlocks = value;
529 get => this.unreferencedBlobBlocks;
530 internal set => this.unreferencedBlobBlocks = value;
535 lock (this.synchObject)
558 lock (this.synchObject)
573 internal void ReportObjectStatistics(uint ObjectSize)
575 lock (this.synchObject)
577 if (ObjectSize < this.minObjSize)
578 this.minObjSize = ObjectSize;
580 if (ObjectSize > this.maxObjSize)
581 this.maxObjSize = ObjectSize;
583 this.sumObjSize += ObjectSize;
588 internal void ReportDepthStatistics(uint Depth)
590 lock (this.synchObject)
592 if (Depth < this.minDepth)
593 this.minDepth = Depth;
595 if (Depth > this.maxDepth)
596 this.maxDepth = Depth;
600 internal void LogError(
string Message)
602 lock (this.synchObject)
604 this.isCorrupt =
true;
606 if (this.comments is
null)
609 this.comments.
Add(Message);
613 internal void LogComment(
string Message)
615 lock (this.synchObject)
617 if (this.comments is
null)
620 this.comments.
Add(Message);
629 public void ToString(StringBuilder Output,
bool WriteStat)
631 lock (this.synchObject)
635 Output.AppendLine(
"Block Size: " + this.blockSize.ToString());
636 Output.AppendLine(
"#Blocks: " + this.nrBlocks.ToString());
637 Output.AppendLine(
"#BLOB Blocks: " + this.nrBlobBlocks.ToString());
638 Output.AppendLine(
"#Bytes used: " + this.nrBytesUsed.ToString());
639 Output.AppendLine(
"#Bytes unused: " + this.nrBytesUnused.ToString());
640 Output.AppendLine(
"#Bytes total: " + this.nrBytesTotal.ToString());
641 Output.AppendLine(
"#BLOB Bytes used: " + this.nrBlobBytesUsed.ToString());
642 Output.AppendLine(
"#BLOB Bytes unused: " + this.nrBlobBytesUnused.ToString());
643 Output.AppendLine(
"#BLOB Bytes total: " + this.nrBlobBytesTotal.ToString());
644 Output.AppendLine(
"#Block loads: " + this.nrBlockLoads.ToString());
645 Output.AppendLine(
"#Cache loads: " + this.nrCacheLoads.ToString());
646 Output.AppendLine(
"#Block saves: " + this.nrBlockSaves.ToString());
647 Output.AppendLine(
"#BLOB Block loads: " + this.nrBlobBlockLoads.ToString());
648 Output.AppendLine(
"#BLOB Block saves: " + this.nrBlobBlockSaves.ToString());
649 Output.AppendLine(
"#Objects: " + this.nrObjects.ToString());
650 Output.AppendLine(
"Smallest object: " + this.minObjSize.ToString());
651 Output.AppendLine(
"Largest object: " + this.maxObjSize.ToString());
653 Output.AppendLine(
"Usage: " + this.
Usage.ToString(
"F2") +
" %");
654 Output.AppendLine(
"Min(Depth): " + this.minDepth.ToString());
655 Output.AppendLine(
"Max(Depth): " + this.maxDepth.ToString());
656 Output.AppendLine(
"Min(Objects/Block): " + this.minObjPerBlock.ToString());
657 Output.AppendLine(
"Max(Objects/Block): " + this.maxObjPerBlock.ToString());
659 Output.AppendLine(
"Min(Bytes Used/Block): " + this.minBytesUsedPerBlock.ToString());
660 Output.AppendLine(
"Max(Bytes Used/Block): " + this.maxBytesUsedPerBlock.ToString());
662 Output.AppendLine(
"Is Corrupt: " + this.isCorrupt.ToString());
663 Output.AppendLine(
"Is Balanced: " + this.isBalanced.ToString());
664 Output.AppendLine(
"Has Comments: " + this.
HasComments.ToString());
670 foreach (
string Comment
in this.
Comments)
671 Output.AppendLine(Comment);
Contains information about a file.
ulong NrBlockLoads
Number of blocks load operations performed.
double AverageBytesUsedPerBlock
Average bytes used per block.
ulong NrBytesUnused
Number of bytes unused.
uint MaxObjectsPerBlock
Largest number of objects in a block.
uint MaxBytesUsedPerBlock
Largest number of bytes used in a block.
ulong NrBlockSaves
Number of blocks save operations performed.
uint MinObjectSize
Size of smallest object.
bool IsCorrupt
If the file is corrupt.
uint NrObjects
Number of objects stored.
uint MaxDepth
Depth of deepest leaf.
ulong NrCacheLoads
Number of blocks load operations performed, where result was fetched from internal cache.
ulong NrBytesUsed
Number of bytes used.
ulong NrBlobBlockLoads
Number of BLOB blocks load operations performed.
int[] UnreferencedBlobBlocks
Unreferenced BLOB blocks, if any.
ulong NrBlobBytesUsed
Number of BLOB bytes used.
uint MinBytesUsedPerBlock
Smallest number of bytes used in a block.
uint MinDepth
Depth of most shallow leaf.
string[] Comments
Any comments logged when scanning the file. If no comments, this property is null.
uint MaxObjectSize
Size of largest object.
uint NrBlobBlocks
Number of BLOB blocks
double Usage
Usage, in percent.
double AverageObjectSize
Average size of object.
ulong NrBlobBytesTotal
Total number of BLOB bytes in file.
ulong NrSearches
Number of searches performed against the file.
int[] UnreferencedBlocks
Unreferenced blocks, if any.
ulong NrFullFileScans
Number of searches performed, resulting in full file scans.
ulong NrBlobBytesUnused
Number of BLOB bytes unused.
uint NrBlocks
Number of blocks
uint MinObjectsPerBlock
Smallest number of objects in a block.
bool HasComments
If comments have been logged.
ulong NrBlobBlockSaves
Number of BLOB blocks save operations performed.
bool IsBalanced
If the file is balanced.
ulong NrBytesTotal
Total number of bytes in file.
double AverageObjectsPerBlock
Average number of objects per block.
void ToString(StringBuilder Output, bool WriteStat)
Outputs file statistics to a string.
FileStatistics(uint BlockSize, ulong NrBlockLoads, ulong NrCacheLoads, ulong NrBlockSaves, ulong NrBlobBlockLoads, ulong NrBlobBlockSaves, ulong NrFullFileScans, ulong NrSearches)
Contains information about a file.
A chunked list is a linked list of chunks of objects of type T .
void Add(T Item)
Adds an item to the collection.
T[] ToArray()
Returns an array containing all elements of the collection.