Rename prof_tctx to alloc_tctx in prof_info_t
This commit is contained in:
parent
5e0b090992
commit
aa1d71fb7a
@ -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);
|
large_prof_info_get(extent, prof_info);
|
||||||
} else {
|
} else {
|
||||||
memset(prof_info, 0, sizeof(prof_info_t));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ extent_slab_data_get_const(const extent_t *extent) {
|
|||||||
static inline void
|
static inline void
|
||||||
extent_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
|
extent_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
|
||||||
assert(prof_info != NULL);
|
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);
|
&extent->e_prof_tctx, ATOMIC_ACQUIRE);
|
||||||
prof_info->alloc_time = extent->e_alloc_time;
|
prof_info->alloc_time = extent->e_alloc_time;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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);
|
moved = (ptr != old_ptr);
|
||||||
|
|
||||||
if (unlikely(sampled)) {
|
if (unlikely(sampled)) {
|
||||||
@ -186,7 +186,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
|
|||||||
} else {
|
} else {
|
||||||
prof_info_t prof_info;
|
prof_info_t prof_info;
|
||||||
prof_info_get(tsd, ptr, NULL, &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);
|
cassert(config_prof);
|
||||||
assert(usize == isalloc(tsd_tsdn(tsd), ptr));
|
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);
|
prof_free_sampled_object(tsd, usize, &prof_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ typedef rb_tree(prof_tctx_t) prof_tctx_tree_t;
|
|||||||
|
|
||||||
struct prof_info_s {
|
struct prof_info_s {
|
||||||
/* Points to the prof_tctx_t corresponding to the allocation. */
|
/* 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. */
|
/* Time when the allocation was made. */
|
||||||
nstime_t alloc_time;
|
nstime_t alloc_time;
|
||||||
};
|
};
|
||||||
|
@ -204,7 +204,7 @@ prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize,
|
|||||||
void
|
void
|
||||||
prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
|
prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
|
||||||
assert(prof_info != NULL);
|
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);
|
assert((uintptr_t)tctx > (uintptr_t)1U);
|
||||||
|
|
||||||
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
|
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||||
|
@ -200,7 +200,7 @@ prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
prof_try_log(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
|
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);
|
malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||||
|
|
||||||
prof_tdata_t *cons_tdata = prof_tdata_get(tsd, false);
|
prof_tdata_t *cons_tdata = prof_tdata_get(tsd, false);
|
||||||
|
@ -16,7 +16,7 @@ TEST_BEGIN(test_prof_realloc) {
|
|||||||
p = mallocx(1024, flags);
|
p = mallocx(1024, flags);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
prof_info_get(tsd, p, NULL, &prof_info_p);
|
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");
|
"Expected valid tctx");
|
||||||
prof_cnt_all(&curobjs_1, NULL, NULL, NULL);
|
prof_cnt_all(&curobjs_1, NULL, NULL, NULL);
|
||||||
assert_u64_eq(curobjs_0 + 1, curobjs_1,
|
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_ne(p, q, "Expected move");
|
||||||
assert_ptr_not_null(p, "Unexpected rmallocx() failure");
|
assert_ptr_not_null(p, "Unexpected rmallocx() failure");
|
||||||
prof_info_get(tsd, q, NULL, &prof_info_q);
|
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");
|
"Expected valid tctx");
|
||||||
prof_cnt_all(&curobjs_2, NULL, NULL, NULL);
|
prof_cnt_all(&curobjs_2, NULL, NULL, NULL);
|
||||||
assert_u64_eq(curobjs_1, curobjs_2,
|
assert_u64_eq(curobjs_1, curobjs_2,
|
||||||
|
Loading…
Reference in New Issue
Block a user