Rename prof_tctx to alloc_tctx in prof_info_t

This commit is contained in:
Yinan Zhang 2019-12-05 15:35:12 -08:00
parent 5e0b090992
commit aa1d71fb7a
7 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ arena_prof_info_get(tsd_t *tsd, const void *ptr, alloc_ctx_t *alloc_ctx,
large_prof_info_get(extent, prof_info);
} else {
memset(prof_info, 0, sizeof(prof_info_t));
prof_info->prof_tctx = (prof_tctx_t *)(uintptr_t)1U;
prof_info->alloc_tctx = (prof_tctx_t *)(uintptr_t)1U;
}
}

View File

@ -336,7 +336,7 @@ extent_slab_data_get_const(const extent_t *extent) {
static inline void
extent_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
assert(prof_info != NULL);
prof_info->prof_tctx = (prof_tctx_t *)atomic_load_p(
prof_info->alloc_tctx = (prof_tctx_t *)atomic_load_p(
&extent->e_prof_tctx, ATOMIC_ACQUIRE);
prof_info->alloc_time = extent->e_alloc_time;
}

View File

@ -168,7 +168,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
}
sampled = ((uintptr_t)tctx > (uintptr_t)1U);
old_sampled = ((uintptr_t)old_prof_info->prof_tctx > (uintptr_t)1U);
old_sampled = ((uintptr_t)old_prof_info->alloc_tctx > (uintptr_t)1U);
moved = (ptr != old_ptr);
if (unlikely(sampled)) {
@ -186,7 +186,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
} else {
prof_info_t prof_info;
prof_info_get(tsd, ptr, NULL, &prof_info);
assert((uintptr_t)prof_info.prof_tctx == (uintptr_t)1U);
assert((uintptr_t)prof_info.alloc_tctx == (uintptr_t)1U);
}
/*
@ -209,7 +209,7 @@ prof_free(tsd_t *tsd, const void *ptr, size_t usize, alloc_ctx_t *alloc_ctx) {
cassert(config_prof);
assert(usize == isalloc(tsd_tsdn(tsd), ptr));
if (unlikely((uintptr_t)prof_info.prof_tctx > (uintptr_t)1U)) {
if (unlikely((uintptr_t)prof_info.alloc_tctx > (uintptr_t)1U)) {
prof_free_sampled_object(tsd, usize, &prof_info);
}
}

View File

@ -98,7 +98,7 @@ typedef rb_tree(prof_tctx_t) prof_tctx_tree_t;
struct prof_info_s {
/* Points to the prof_tctx_t corresponding to the allocation. */
prof_tctx_t *prof_tctx;
prof_tctx_t *alloc_tctx;
/* Time when the allocation was made. */
nstime_t alloc_time;
};

View File

@ -204,7 +204,7 @@ prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize,
void
prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
assert(prof_info != NULL);
prof_tctx_t *tctx = prof_info->prof_tctx;
prof_tctx_t *tctx = prof_info->alloc_tctx;
assert((uintptr_t)tctx > (uintptr_t)1U);
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);

View File

@ -200,7 +200,7 @@ prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) {
void
prof_try_log(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
prof_tctx_t *tctx = prof_info->prof_tctx;
prof_tctx_t *tctx = prof_info->alloc_tctx;
malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock);
prof_tdata_t *cons_tdata = prof_tdata_get(tsd, false);

View File

@ -16,7 +16,7 @@ TEST_BEGIN(test_prof_realloc) {
p = mallocx(1024, flags);
assert_ptr_not_null(p, "Unexpected mallocx() failure");
prof_info_get(tsd, p, NULL, &prof_info_p);
assert_ptr_ne(prof_info_p.prof_tctx, (prof_tctx_t *)(uintptr_t)1U,
assert_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,
@ -26,7 +26,7 @@ TEST_BEGIN(test_prof_realloc) {
assert_ptr_ne(p, q, "Expected move");
assert_ptr_not_null(p, "Unexpected rmallocx() failure");
prof_info_get(tsd, q, NULL, &prof_info_q);
assert_ptr_ne(prof_info_q.prof_tctx, (prof_tctx_t *)(uintptr_t)1U,
assert_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,