mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 17:17:19 +03:00
Change tsdn to tsd for profiling code path
This commit is contained in:
parent
b55419f9b9
commit
6945371778
8 changed files with 50 additions and 52 deletions
|
|
@ -2171,7 +2171,7 @@ imalloc_body(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd) {
|
|||
prof_alloc_rollback(tsd, tctx, true);
|
||||
goto label_oom;
|
||||
}
|
||||
prof_malloc(tsd_tsdn(tsd), allocation, usize, &alloc_ctx, tctx);
|
||||
prof_malloc(tsd, allocation, usize, &alloc_ctx, tctx);
|
||||
} else {
|
||||
assert(!opt_prof);
|
||||
allocation = imalloc_no_sample(sopts, dopts, tsd, size, usize,
|
||||
|
|
@ -3010,7 +3010,7 @@ irallocx_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
|
|||
size_t alignment, size_t *usize, bool zero, tcache_t *tcache,
|
||||
arena_t *arena, alloc_ctx_t *alloc_ctx, hook_ralloc_args_t *hook_args) {
|
||||
prof_info_t old_prof_info;
|
||||
prof_info_get(tsd_tsdn(tsd), old_ptr, alloc_ctx, &old_prof_info);
|
||||
prof_info_get(tsd, old_ptr, alloc_ctx, &old_prof_info);
|
||||
bool prof_active = prof_active_get_unlocked();
|
||||
prof_tctx_t *tctx = prof_alloc_prep(tsd, *usize, prof_active, false);
|
||||
void *p;
|
||||
|
|
@ -3261,7 +3261,7 @@ JEMALLOC_ALWAYS_INLINE size_t
|
|||
ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
|
||||
size_t extra, size_t alignment, bool zero, alloc_ctx_t *alloc_ctx) {
|
||||
prof_info_t old_prof_info;
|
||||
prof_info_get(tsd_tsdn(tsd), ptr, alloc_ctx, &old_prof_info);
|
||||
prof_info_get(tsd, ptr, alloc_ctx, &old_prof_info);
|
||||
/*
|
||||
* usize isn't knowable before ixalloc() returns when extra is non-zero.
|
||||
* Therefore, compute its maximum possible value and use that in
|
||||
|
|
|
|||
|
|
@ -368,19 +368,18 @@ large_salloc(tsdn_t *tsdn, const extent_t *extent) {
|
|||
}
|
||||
|
||||
void
|
||||
large_prof_info_get(tsdn_t *tsdn, const extent_t *extent,
|
||||
prof_info_t *prof_info) {
|
||||
large_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
|
||||
extent_prof_info_get(extent, prof_info);
|
||||
}
|
||||
|
||||
void
|
||||
large_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, prof_tctx_t *tctx) {
|
||||
large_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx) {
|
||||
extent_prof_tctx_set(extent, tctx);
|
||||
}
|
||||
|
||||
void
|
||||
large_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent) {
|
||||
large_prof_tctx_set(tsdn, extent, (prof_tctx_t *)(uintptr_t)1U);
|
||||
large_prof_tctx_reset(extent_t *extent) {
|
||||
large_prof_tctx_set(extent, (prof_tctx_t *)(uintptr_t)1U);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
10
src/prof.c
10
src/prof.c
|
|
@ -165,17 +165,17 @@ prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
|
|||
}
|
||||
|
||||
void
|
||||
prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
|
||||
prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize,
|
||||
prof_tctx_t *tctx) {
|
||||
prof_tctx_set(tsdn, ptr, usize, NULL, tctx);
|
||||
prof_tctx_set(tsd, ptr, usize, NULL, tctx);
|
||||
|
||||
/* Get the current time and set this in the extent_t. We'll read this
|
||||
* when free() is called. */
|
||||
nstime_t t = NSTIME_ZERO_INITIALIZER;
|
||||
nstime_update(&t);
|
||||
prof_alloc_time_set(tsdn, ptr, t);
|
||||
prof_alloc_time_set(tsd, ptr, t);
|
||||
|
||||
malloc_mutex_lock(tsdn, tctx->tdata->lock);
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||
tctx->cnts.curobjs++;
|
||||
tctx->cnts.curbytes += usize;
|
||||
if (opt_prof_accum) {
|
||||
|
|
@ -183,7 +183,7 @@ prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
|
|||
tctx->cnts.accumbytes += usize;
|
||||
}
|
||||
tctx->prepared = false;
|
||||
malloc_mutex_unlock(tsdn, tctx->tdata->lock);
|
||||
malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue