From 4fbbc817c1130d3d6c066f132fb5a2b23803be89 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Mon, 15 Jul 2019 10:37:09 -0700 Subject: [PATCH] Simplify time setting and getting for prof log --- include/jemalloc/internal/arena_inlines_b.h | 6 ++---- include/jemalloc/internal/prof_inlines_b.h | 9 ++++----- src/prof.c | 2 +- src/prof_log.c | 3 +-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/jemalloc/internal/arena_inlines_b.h b/include/jemalloc/internal/arena_inlines_b.h index a6135ee7..7ac2f942 100644 --- a/include/jemalloc/internal/arena_inlines_b.h +++ b/include/jemalloc/internal/arena_inlines_b.h @@ -90,8 +90,7 @@ arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx) { } JEMALLOC_ALWAYS_INLINE nstime_t -arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr, - alloc_ctx_t *alloc_ctx) { +arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr) { cassert(config_prof); assert(ptr != NULL); @@ -105,8 +104,7 @@ arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr, } JEMALLOC_ALWAYS_INLINE void -arena_prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx, - nstime_t t) { +arena_prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, nstime_t t) { cassert(config_prof); assert(ptr != NULL); diff --git a/include/jemalloc/internal/prof_inlines_b.h b/include/jemalloc/internal/prof_inlines_b.h index c750a25b..6b10f5bf 100644 --- a/include/jemalloc/internal/prof_inlines_b.h +++ b/include/jemalloc/internal/prof_inlines_b.h @@ -64,20 +64,19 @@ prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx) { } JEMALLOC_ALWAYS_INLINE nstime_t -prof_alloc_time_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) { +prof_alloc_time_get(tsdn_t *tsdn, const void *ptr) { cassert(config_prof); assert(ptr != NULL); - return arena_prof_alloc_time_get(tsdn, ptr, alloc_ctx); + return arena_prof_alloc_time_get(tsdn, ptr); } JEMALLOC_ALWAYS_INLINE void -prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx, - nstime_t t) { +prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, nstime_t t) { cassert(config_prof); assert(ptr != NULL); - arena_prof_alloc_time_set(tsdn, ptr, alloc_ctx, t); + arena_prof_alloc_time_set(tsdn, ptr, t); } JEMALLOC_ALWAYS_INLINE bool diff --git a/src/prof.c b/src/prof.c index a702cc2b..fc0c7d8a 100644 --- a/src/prof.c +++ b/src/prof.c @@ -169,7 +169,7 @@ prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize, * when free() is called. */ nstime_t t = NSTIME_ZERO_INITIALIZER; nstime_update(&t); - prof_alloc_time_set(tsdn, ptr, NULL, t); + prof_alloc_time_set(tsdn, ptr, t); malloc_mutex_lock(tsdn, tctx->tdata->lock); tctx->cnts.curobjs++; diff --git a/src/prof_log.c b/src/prof_log.c index af91af7d..c95f29e4 100644 --- a/src/prof_log.c +++ b/src/prof_log.c @@ -229,8 +229,7 @@ prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) { log_tables_initialized = true; } - nstime_t alloc_time = prof_alloc_time_get(tsd_tsdn(tsd), ptr, - (alloc_ctx_t *)NULL); + nstime_t alloc_time = prof_alloc_time_get(tsd_tsdn(tsd), ptr); nstime_t free_time = NSTIME_ZERO_INITIALIZER; nstime_update(&free_time);