MCPcopy
hub / github.com/RoaringBitmap/roaring / Stats

Method Stats

roaring.go:2418–2440  ·  view source on GitHub ↗

Stats returns details on container type usage in a Statistics struct.

()

Source from the content-addressed store, hash-verified

2416
2417// Stats returns details on container type usage in a Statistics struct.
2418func (rb *Bitmap) Stats() Statistics {
2419 stats := Statistics{}
2420 stats.Containers = uint64(len(rb.highlowcontainer.containers))
2421 for _, c := range rb.highlowcontainer.containers {
2422 stats.Cardinality += uint64(c.getCardinality())
2423
2424 switch c.(type) {
2425 case *arrayContainer:
2426 stats.ArrayContainers++
2427 stats.ArrayContainerBytes += uint64(c.getSizeInBytes())
2428 stats.ArrayContainerValues += uint64(c.getCardinality())
2429 case *bitmapContainer:
2430 stats.BitmapContainers++
2431 stats.BitmapContainerBytes += uint64(c.getSizeInBytes())
2432 stats.BitmapContainerValues += uint64(c.getCardinality())
2433 case *runContainer16:
2434 stats.RunContainers++
2435 stats.RunContainerBytes += uint64(c.getSizeInBytes())
2436 stats.RunContainerValues += uint64(c.getCardinality())
2437 }
2438 }
2439 return stats
2440}
2441
2442// Describe prints a description of the bitmap's containers to stdout
2443func (rb *Bitmap) Describe() {

Callers 3

TestStatsCOWFunction · 0.95
TestStatsFunction · 0.95
TestBitmap_FromBufferFunction · 0.95

Calls 2

getCardinalityMethod · 0.65
getSizeInBytesMethod · 0.65

Tested by 3

TestStatsCOWFunction · 0.76
TestStatsFunction · 0.76
TestBitmap_FromBufferFunction · 0.76