metadata usage breakdowns: tracking edata and rtree usages

This commit is contained in:
Shirui Cheng
2023-10-10 09:46:23 -07:00
committed by Qi Wang
parent 005f20aa7f
commit 36becb1302
10 changed files with 116 additions and 30 deletions

View File

@@ -28,7 +28,8 @@ static extent_hooks_t hooks_not_null = {
TEST_BEGIN(test_base_hooks_default) {
base_t *base;
size_t allocated0, allocated1, resident, mapped, n_thp;
size_t allocated0, allocated1, edata_allocated,
rtree_allocated, resident, mapped, n_thp;
tsdn_t *tsdn = tsd_tsdn(tsd_fetch());
base = base_new(tsdn, 0,
@@ -36,8 +37,8 @@ TEST_BEGIN(test_base_hooks_default) {
/* metadata_use_hooks */ true);
if (config_stats) {
base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
&n_thp);
base_stats_get(tsdn, base, &allocated0, &edata_allocated,
&rtree_allocated, &resident, &mapped, &n_thp);
expect_zu_ge(allocated0, sizeof(base_t),
"Base header should count as allocated");
if (opt_metadata_thp == metadata_thp_always) {
@@ -50,8 +51,8 @@ TEST_BEGIN(test_base_hooks_default) {
"Unexpected base_alloc() failure");
if (config_stats) {
base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
&n_thp);
base_stats_get(tsdn, base, &allocated1, &edata_allocated,
&rtree_allocated, &resident, &mapped, &n_thp);
expect_zu_ge(allocated1 - allocated0, 42,
"At least 42 bytes were allocated by base_alloc()");
}
@@ -63,7 +64,8 @@ TEST_END
TEST_BEGIN(test_base_hooks_null) {
extent_hooks_t hooks_orig;
base_t *base;
size_t allocated0, allocated1, resident, mapped, n_thp;
size_t allocated0, allocated1, edata_allocated,
rtree_allocated, resident, mapped, n_thp;
extent_hooks_prep();
try_dalloc = false;
@@ -79,8 +81,8 @@ TEST_BEGIN(test_base_hooks_null) {
expect_ptr_not_null(base, "Unexpected base_new() failure");
if (config_stats) {
base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
&n_thp);
base_stats_get(tsdn, base, &allocated0, &edata_allocated,
&rtree_allocated, &resident, &mapped, &n_thp);
expect_zu_ge(allocated0, sizeof(base_t),
"Base header should count as allocated");
if (opt_metadata_thp == metadata_thp_always) {
@@ -93,8 +95,8 @@ TEST_BEGIN(test_base_hooks_null) {
"Unexpected base_alloc() failure");
if (config_stats) {
base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
&n_thp);
base_stats_get(tsdn, base, &allocated1, &edata_allocated,
&rtree_allocated, &resident, &mapped, &n_thp);
expect_zu_ge(allocated1 - allocated0, 42,
"At least 42 bytes were allocated by base_alloc()");
}