[Zion] Add more debug information about kernel heap usage.

This will be helpful as we work to improve it.

Without deallocations, we currently stand at the following alloc numbers
8 - 142
16 - 319
32 - 364

unsized - 305

total page usage including slabs is 12.
This commit is contained in:
Drew Galbraith 2023-11-15 12:36:18 -08:00
parent 4657c46f73
commit 6d27ee5dc5
6 changed files with 87 additions and 35 deletions

View file

@ -19,6 +19,7 @@ class Slab : public glcr::RefCounted<Slab>,
void Free(void* addr);
bool IsFull();
uint64_t Allocations() { return num_allocated_; }
private:
struct FreeListEntry {
@ -39,6 +40,10 @@ class SlabAllocator {
glcr::ErrorOr<void*> Allocate();
// Stats:
uint64_t SlabCount();
uint64_t Allocations();
private:
uint64_t elem_size_;
glcr::IntrusiveList<Slab> slabs_;