psset: Add stats

This commit is contained in:
David Goldblatt
2020-09-02 12:59:10 -07:00
committed by David Goldblatt
parent 018b162d67
commit 259c5e3e8f
4 changed files with 178 additions and 13 deletions

View File

@@ -218,13 +218,17 @@ struct edata_s {
*/
edata_t *ps;
/*
* If this edata *is* a pageslab, then it has some longest free
* range in it. Track it.
* If this edata *is* a pageslab, then we cache some useful
* information about its associated bitmap.
*/
struct {
/*
* The longest free range a pageslab contains determines
* the heap it lives in. If we know that it didn't
* change after an operation, we can avoid moving it
* between heaps.
*/
uint32_t longest_free_range;
/* Not yet tracked. */
/* uint32_t longest_free_range_pos; */
};
};

View File

@@ -21,6 +21,16 @@
*/
#define PSSET_NPSIZES 64
typedef struct psset_bin_stats_s psset_bin_stats_t;
struct psset_bin_stats_s {
/* How many pageslabs are in this bin? */
size_t npageslabs;
/* Of them, how many pages are active? */
size_t nactive;
/* How many are inactive? */
size_t ninactive;
};
typedef struct psset_s psset_t;
struct psset_s {
/*
@@ -29,6 +39,12 @@ struct psset_s {
*/
edata_heap_t pageslabs[PSSET_NPSIZES];
bitmap_t bitmap[BITMAP_GROUPS(PSSET_NPSIZES)];
/*
* Full slabs don't live in any edata heap. But we still track their
* stats.
*/
psset_bin_stats_t full_slab_stats;
psset_bin_stats_t slab_stats[PSSET_NPSIZES];
};
void psset_init(psset_t *psset);