mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Add stats for stashed bytes in tcache.
This commit is contained in:
@@ -367,7 +367,7 @@ TEST_END
|
||||
static void
|
||||
test_tcache_bytes_for_usize(size_t usize) {
|
||||
uint64_t epoch;
|
||||
size_t tcache_bytes;
|
||||
size_t tcache_bytes, tcache_stashed_bytes;
|
||||
size_t sz = sizeof(tcache_bytes);
|
||||
|
||||
void *ptr = mallocx(usize, 0);
|
||||
@@ -377,7 +377,11 @@ test_tcache_bytes_for_usize(size_t usize) {
|
||||
assert_d_eq(mallctl(
|
||||
"stats.arenas." STRINGIFY(MALLCTL_ARENAS_ALL) ".tcache_bytes",
|
||||
&tcache_bytes, &sz, NULL, 0), 0, "Unexpected mallctl failure");
|
||||
size_t tcache_bytes_before = tcache_bytes;
|
||||
assert_d_eq(mallctl(
|
||||
"stats.arenas." STRINGIFY(MALLCTL_ARENAS_ALL)
|
||||
".tcache_stashed_bytes", &tcache_stashed_bytes, &sz, NULL, 0), 0,
|
||||
"Unexpected mallctl failure");
|
||||
size_t tcache_bytes_before = tcache_bytes + tcache_stashed_bytes;
|
||||
dallocx(ptr, 0);
|
||||
|
||||
expect_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||
@@ -385,7 +389,11 @@ test_tcache_bytes_for_usize(size_t usize) {
|
||||
assert_d_eq(mallctl(
|
||||
"stats.arenas." STRINGIFY(MALLCTL_ARENAS_ALL) ".tcache_bytes",
|
||||
&tcache_bytes, &sz, NULL, 0), 0, "Unexpected mallctl failure");
|
||||
size_t tcache_bytes_after = tcache_bytes;
|
||||
assert_d_eq(mallctl(
|
||||
"stats.arenas." STRINGIFY(MALLCTL_ARENAS_ALL)
|
||||
".tcache_stashed_bytes", &tcache_stashed_bytes, &sz, NULL, 0), 0,
|
||||
"Unexpected mallctl failure");
|
||||
size_t tcache_bytes_after = tcache_bytes + tcache_stashed_bytes;
|
||||
assert_zu_eq(tcache_bytes_after - tcache_bytes_before,
|
||||
usize, "Incorrectly attributed a free");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user