From ad3f3fc561d5829a0a998c1b0650f6e7c7474a74 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Tue, 14 Jan 2020 11:12:18 -0800 Subject: [PATCH] Fetch time after tctx and only for samples --- src/large.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/large.c b/src/large.c index ca35fc54..9b946178 100644 --- a/src/large.c +++ b/src/large.c @@ -372,18 +372,20 @@ void large_prof_info_get(tsd_t *tsd, edata_t *edata, prof_info_t *prof_info, bool reset_recent) { assert(prof_info != NULL); - nstime_copy(&prof_info->alloc_time, edata_prof_alloc_time_get(edata)); prof_tctx_t *alloc_tctx = edata_prof_tctx_get(edata); prof_info->alloc_tctx = alloc_tctx; - if (reset_recent && (uintptr_t)alloc_tctx > (uintptr_t)1U) { - /* - * This allocation was a prof sample. Reset the pointer on the - * recent allocation record, so that this allocation is - * recorded as released. - */ - prof_recent_alloc_reset(tsd, edata); + if ((uintptr_t)alloc_tctx > (uintptr_t)1U) { + nstime_copy(&prof_info->alloc_time, + edata_prof_alloc_time_get(edata)); + if (reset_recent) { + /* + * Reset the pointer on the recent allocation record, + * so that this allocation is recorded as released. + */ + prof_recent_alloc_reset(tsd, edata); + } } }