aboutsummaryrefslogtreecommitdiff
path: root/test/unit/prof_tctx.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-02-05 23:20:13 +0000
committerWarner Losh <imp@FreeBSD.org>2025-02-05 23:20:13 +0000
commit48ec896efb0b78141df004eaa21288b84590c9da (patch)
tree33799792fd95c266d472ab1ae51d50ab4f942eb3 /test/unit/prof_tctx.c
parentd28d7fbede216494aa3942af042cc084fcd6098a (diff)
Import jemalloc 5.3.0. This import changes how manage the jemalloc vendor branch (which was just started anyway). Starting with 5.3.0, we import a clean tree from the upstream github, removing all the old files that are no longer upstream, or that we've kept around for some reason. We do this because we merge from this raw version of jemalloc into the FreeBSD contrib/jemalloc, then we run autogen stuff, generate all the generated .h files with gmake, then finally remove much of the generated files in contrib/jemalloc using an update script. Sponsored by: Netflix
Diffstat (limited to 'test/unit/prof_tctx.c')
-rw-r--r--test/unit/prof_tctx.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/test/unit/prof_tctx.c b/test/unit/prof_tctx.c
index ff3b2b0caac7..e0efdc36a78e 100644
--- a/test/unit/prof_tctx.c
+++ b/test/unit/prof_tctx.c
@@ -1,40 +1,42 @@
#include "test/jemalloc_test.h"
+#include "jemalloc/internal/prof_data.h"
+
TEST_BEGIN(test_prof_realloc) {
- tsdn_t *tsdn;
+ tsd_t *tsd;
int flags;
void *p, *q;
- prof_tctx_t *tctx_p, *tctx_q;
- uint64_t curobjs_0, curobjs_1, curobjs_2, curobjs_3;
+ prof_info_t prof_info_p, prof_info_q;
+ prof_cnt_t cnt_0, cnt_1, cnt_2, cnt_3;
test_skip_if(!config_prof);
- tsdn = tsdn_fetch();
+ tsd = tsd_fetch();
flags = MALLOCX_TCACHE_NONE;
- prof_cnt_all(&curobjs_0, NULL, NULL, NULL);
+ prof_cnt_all(&cnt_0);
p = mallocx(1024, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- tctx_p = prof_tctx_get(tsdn, p, NULL);
- assert_ptr_ne(tctx_p, (prof_tctx_t *)(uintptr_t)1U,
+ expect_ptr_not_null(p, "Unexpected mallocx() failure");
+ prof_info_get(tsd, p, NULL, &prof_info_p);
+ expect_ptr_ne(prof_info_p.alloc_tctx, (prof_tctx_t *)(uintptr_t)1U,
"Expected valid tctx");
- prof_cnt_all(&curobjs_1, NULL, NULL, NULL);
- assert_u64_eq(curobjs_0 + 1, curobjs_1,
+ prof_cnt_all(&cnt_1);
+ expect_u64_eq(cnt_0.curobjs + 1, cnt_1.curobjs,
"Allocation should have increased sample size");
q = rallocx(p, 2048, flags);
- assert_ptr_ne(p, q, "Expected move");
- assert_ptr_not_null(p, "Unexpected rmallocx() failure");
- tctx_q = prof_tctx_get(tsdn, q, NULL);
- assert_ptr_ne(tctx_q, (prof_tctx_t *)(uintptr_t)1U,
+ expect_ptr_ne(p, q, "Expected move");
+ expect_ptr_not_null(p, "Unexpected rmallocx() failure");
+ prof_info_get(tsd, q, NULL, &prof_info_q);
+ expect_ptr_ne(prof_info_q.alloc_tctx, (prof_tctx_t *)(uintptr_t)1U,
"Expected valid tctx");
- prof_cnt_all(&curobjs_2, NULL, NULL, NULL);
- assert_u64_eq(curobjs_1, curobjs_2,
+ prof_cnt_all(&cnt_2);
+ expect_u64_eq(cnt_1.curobjs, cnt_2.curobjs,
"Reallocation should not have changed sample size");
dallocx(q, flags);
- prof_cnt_all(&curobjs_3, NULL, NULL, NULL);
- assert_u64_eq(curobjs_0, curobjs_3,
+ prof_cnt_all(&cnt_3);
+ expect_u64_eq(cnt_0.curobjs, cnt_3.curobjs,
"Sample size should have returned to base level");
}
TEST_END