Add stats for metadata_thp.
Report number of THPs used in arena and aggregated stats.
This commit is contained in:
@@ -28,22 +28,28 @@ static extent_hooks_t hooks_not_null = {
|
||||
|
||||
TEST_BEGIN(test_base_hooks_default) {
|
||||
base_t *base;
|
||||
size_t allocated0, allocated1, resident, mapped;
|
||||
size_t allocated0, allocated1, resident, mapped, n_thp;
|
||||
|
||||
tsdn_t *tsdn = tsd_tsdn(tsd_fetch());
|
||||
base = base_new(tsdn, 0, (extent_hooks_t *)&extent_hooks_default);
|
||||
|
||||
if (config_stats) {
|
||||
base_stats_get(tsdn, base, &allocated0, &resident, &mapped);
|
||||
base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
|
||||
&n_thp);
|
||||
assert_zu_ge(allocated0, sizeof(base_t),
|
||||
"Base header should count as allocated");
|
||||
if (opt_metadata_thp == metadata_thp_always) {
|
||||
assert_zu_gt(n_thp, 0,
|
||||
"Base should have 1 THP at least.");
|
||||
}
|
||||
}
|
||||
|
||||
assert_ptr_not_null(base_alloc(tsdn, base, 42, 1),
|
||||
"Unexpected base_alloc() failure");
|
||||
|
||||
if (config_stats) {
|
||||
base_stats_get(tsdn, base, &allocated1, &resident, &mapped);
|
||||
base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
|
||||
&n_thp);
|
||||
assert_zu_ge(allocated1 - allocated0, 42,
|
||||
"At least 42 bytes were allocated by base_alloc()");
|
||||
}
|
||||
@@ -55,7 +61,7 @@ TEST_END
|
||||
TEST_BEGIN(test_base_hooks_null) {
|
||||
extent_hooks_t hooks_orig;
|
||||
base_t *base;
|
||||
size_t allocated0, allocated1, resident, mapped;
|
||||
size_t allocated0, allocated1, resident, mapped, n_thp;
|
||||
|
||||
extent_hooks_prep();
|
||||
try_dalloc = false;
|
||||
@@ -71,16 +77,22 @@ TEST_BEGIN(test_base_hooks_null) {
|
||||
assert_ptr_not_null(base, "Unexpected base_new() failure");
|
||||
|
||||
if (config_stats) {
|
||||
base_stats_get(tsdn, base, &allocated0, &resident, &mapped);
|
||||
base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
|
||||
&n_thp);
|
||||
assert_zu_ge(allocated0, sizeof(base_t),
|
||||
"Base header should count as allocated");
|
||||
if (opt_metadata_thp == metadata_thp_always) {
|
||||
assert_zu_gt(n_thp, 0,
|
||||
"Base should have 1 THP at least.");
|
||||
}
|
||||
}
|
||||
|
||||
assert_ptr_not_null(base_alloc(tsdn, base, 42, 1),
|
||||
"Unexpected base_alloc() failure");
|
||||
|
||||
if (config_stats) {
|
||||
base_stats_get(tsdn, base, &allocated1, &resident, &mapped);
|
||||
base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
|
||||
&n_thp);
|
||||
assert_zu_ge(allocated1 - allocated0, 42,
|
||||
"At least 42 bytes were allocated by base_alloc()");
|
||||
}
|
||||
|
Reference in New Issue
Block a user