mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-13 20:27:23 +03:00
Add stats for metadata_thp.
Report number of THPs used in arena and aggregated stats.
This commit is contained in:
parent
47b20bb654
commit
e55c3ca267
10 changed files with 125 additions and 21 deletions
|
|
@ -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()");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue