summaryrefslogtreecommitdiffstats
path: root/include/jemalloc/internal/prof_inlines_b.h
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-04-12 01:13:10 (GMT)
committerQi Wang <interwq@gmail.com>2017-04-12 20:55:39 (GMT)
commitccfe68a916baecc50fd7eae3d5be945469016e4c (patch)
treec2fcd4be72ab8b0ec11740838f57fc4ea10c046a /include/jemalloc/internal/prof_inlines_b.h
parentf35213bae4ee6294a0743607637f9be8989622f1 (diff)
downloadjemalloc-ccfe68a916baecc50fd7eae3d5be945469016e4c.zip
jemalloc-ccfe68a916baecc50fd7eae3d5be945469016e4c.tar.gz
jemalloc-ccfe68a916baecc50fd7eae3d5be945469016e4c.tar.bz2
Pass alloc_ctx down profiling path.
With this change, when profiling is enabled, we avoid doing redundant rtree lookups. Also changed dalloc_atx_t to alloc_atx_t, as it's now used on allocation path as well (to speed up profiling).
Diffstat (limited to 'include/jemalloc/internal/prof_inlines_b.h')
-rw-r--r--include/jemalloc/internal/prof_inlines_b.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/include/jemalloc/internal/prof_inlines_b.h b/include/jemalloc/internal/prof_inlines_b.h
index 5ee72c5..6a79c01 100644
--- a/include/jemalloc/internal/prof_inlines_b.h
+++ b/include/jemalloc/internal/prof_inlines_b.h
@@ -5,20 +5,22 @@
bool prof_active_get_unlocked(void);
bool prof_gdump_get_unlocked(void);
prof_tdata_t *prof_tdata_get(tsd_t *tsd, bool create);
-prof_tctx_t *prof_tctx_get(tsdn_t *tsdn, const void *ptr);
+prof_tctx_t *prof_tctx_get(tsdn_t *tsdn, const void *ptr,
+ alloc_ctx_t *alloc_ctx);
void prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
+ alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx);
void prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx);
bool prof_sample_accum_update(tsd_t *tsd, size_t usize, bool update,
prof_tdata_t **tdata_out);
prof_tctx_t *prof_alloc_prep(tsd_t *tsd, size_t usize, bool prof_active,
bool update);
void prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
+ alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx);
void prof_realloc(tsd_t *tsd, const void *ptr, size_t usize,
prof_tctx_t *tctx, bool prof_active, bool updated, const void *old_ptr,
size_t old_usize, prof_tctx_t *old_tctx);
-void prof_free(tsd_t *tsd, const void *ptr, size_t usize);
+void prof_free(tsd_t *tsd, const void *ptr, size_t usize,
+ alloc_ctx_t *alloc_ctx);
#endif
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_PROF_C_))
@@ -67,19 +69,20 @@ prof_tdata_get(tsd_t *tsd, bool create) {
}
JEMALLOC_ALWAYS_INLINE prof_tctx_t *
-prof_tctx_get(tsdn_t *tsdn, const void *ptr) {
+prof_tctx_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) {
cassert(config_prof);
assert(ptr != NULL);
- return arena_prof_tctx_get(tsdn, ptr);
+ return arena_prof_tctx_get(tsdn, ptr, alloc_ctx);
}
JEMALLOC_ALWAYS_INLINE void
-prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize, prof_tctx_t *tctx) {
+prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
+ alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx) {
cassert(config_prof);
assert(ptr != NULL);
- arena_prof_tctx_set(tsdn, ptr, usize, tctx);
+ arena_prof_tctx_set(tsdn, ptr, usize, alloc_ctx, tctx);
}
JEMALLOC_ALWAYS_INLINE void
@@ -145,7 +148,8 @@ prof_alloc_prep(tsd_t *tsd, size_t usize, bool prof_active, bool update) {
}
JEMALLOC_ALWAYS_INLINE void
-prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize, prof_tctx_t *tctx) {
+prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize, alloc_ctx_t *alloc_ctx,
+ prof_tctx_t *tctx) {
cassert(config_prof);
assert(ptr != NULL);
assert(usize == isalloc(tsdn, ptr));
@@ -153,7 +157,8 @@ prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize, prof_tctx_t *tctx) {
if (unlikely((uintptr_t)tctx > (uintptr_t)1U)) {
prof_malloc_sample_object(tsdn, ptr, usize, tctx);
} else {
- prof_tctx_set(tsdn, ptr, usize, (prof_tctx_t *)(uintptr_t)1U);
+ prof_tctx_set(tsdn, ptr, usize, alloc_ctx,
+ (prof_tctx_t *)(uintptr_t)1U);
}
}
@@ -188,7 +193,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
if (unlikely(sampled)) {
prof_malloc_sample_object(tsd_tsdn(tsd), ptr, usize, tctx);
} else if (moved) {
- prof_tctx_set(tsd_tsdn(tsd), ptr, usize,
+ prof_tctx_set(tsd_tsdn(tsd), ptr, usize, NULL,
(prof_tctx_t *)(uintptr_t)1U);
} else if (unlikely(old_sampled)) {
/*
@@ -199,7 +204,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
*/
prof_tctx_reset(tsd_tsdn(tsd), ptr, tctx);
} else {
- assert((uintptr_t)prof_tctx_get(tsd_tsdn(tsd), ptr) ==
+ assert((uintptr_t)prof_tctx_get(tsd_tsdn(tsd), ptr, NULL) ==
(uintptr_t)1U);
}
@@ -216,8 +221,8 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
}
JEMALLOC_ALWAYS_INLINE void
-prof_free(tsd_t *tsd, const void *ptr, size_t usize) {
- prof_tctx_t *tctx = prof_tctx_get(tsd_tsdn(tsd), ptr);
+prof_free(tsd_t *tsd, const void *ptr, size_t usize, alloc_ctx_t *alloc_ctx) {
+ prof_tctx_t *tctx = prof_tctx_get(tsd_tsdn(tsd), ptr, alloc_ctx);
cassert(config_prof);
assert(usize == isalloc(tsd_tsdn(tsd), ptr));