Record request size in prof recent entries
This commit is contained in:
@@ -2175,7 +2175,7 @@ imalloc_body(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd) {
|
||||
prof_alloc_rollback(tsd, tctx, true);
|
||||
goto label_oom;
|
||||
}
|
||||
prof_malloc(tsd, allocation, usize, &alloc_ctx, tctx);
|
||||
prof_malloc(tsd, allocation, size, usize, &alloc_ctx, tctx);
|
||||
} else {
|
||||
assert(!opt_prof);
|
||||
allocation = imalloc_no_sample(sopts, dopts, tsd, size, usize,
|
||||
@@ -3045,8 +3045,8 @@ irallocx_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
|
||||
*/
|
||||
*usize = isalloc(tsd_tsdn(tsd), p);
|
||||
}
|
||||
prof_realloc(tsd, p, *usize, tctx, prof_active, old_ptr, old_usize,
|
||||
&old_prof_info);
|
||||
prof_realloc(tsd, p, size, *usize, tctx, prof_active, old_ptr,
|
||||
old_usize, &old_prof_info);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -3338,7 +3338,7 @@ ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
|
||||
prof_alloc_rollback(tsd, tctx, false);
|
||||
} else {
|
||||
prof_info_get_and_reset_recent(tsd, ptr, alloc_ctx, &prof_info);
|
||||
prof_realloc(tsd, ptr, usize, tctx, prof_active, ptr,
|
||||
prof_realloc(tsd, ptr, size, usize, tctx, prof_active, ptr,
|
||||
old_usize, &prof_info);
|
||||
}
|
||||
|
||||
|
@@ -145,8 +145,8 @@ prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
|
||||
}
|
||||
|
||||
void
|
||||
prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize,
|
||||
prof_tctx_t *tctx) {
|
||||
prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t size,
|
||||
size_t usize, prof_tctx_t *tctx) {
|
||||
edata_t *edata = iealloc(tsd_tsdn(tsd), ptr);
|
||||
prof_info_set(tsd, edata, tctx);
|
||||
|
||||
@@ -162,7 +162,7 @@ prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize,
|
||||
malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||
if (record_recent) {
|
||||
assert(tctx == edata_prof_tctx_get(edata));
|
||||
prof_recent_alloc(tsd, edata, usize);
|
||||
prof_recent_alloc(tsd, edata, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -249,7 +249,7 @@ prof_recent_alloc_assert_count(tsd_t *tsd) {
|
||||
}
|
||||
|
||||
void
|
||||
prof_recent_alloc(tsd_t *tsd, edata_t *edata, size_t usize) {
|
||||
prof_recent_alloc(tsd_t *tsd, edata_t *edata, size_t size) {
|
||||
assert(edata != NULL);
|
||||
prof_tctx_t *tctx = edata_prof_tctx_get(edata);
|
||||
|
||||
@@ -312,7 +312,7 @@ prof_recent_alloc(tsd_t *tsd, edata_t *edata, size_t usize) {
|
||||
{
|
||||
/* Fill content into the dummy node. */
|
||||
prof_recent_t *node = prof_recent_alloc_dummy;
|
||||
node->usize = usize;
|
||||
node->size = size;
|
||||
nstime_copy(&node->alloc_time,
|
||||
edata_prof_alloc_time_get(edata));
|
||||
node->alloc_tctx = tctx;
|
||||
@@ -487,8 +487,9 @@ prof_recent_alloc_dump(tsd_t *tsd, void (*write_cb)(void *, const char *),
|
||||
n = prof_recent_alloc_next(tsd, n)) {
|
||||
emitter_json_object_begin(&emitter);
|
||||
|
||||
emitter_json_kv(&emitter, "usize", emitter_type_size,
|
||||
&n->usize);
|
||||
emitter_json_kv(&emitter, "size", emitter_type_size, &n->size);
|
||||
size_t usize = sz_s2u(n->size);
|
||||
emitter_json_kv(&emitter, "usize", emitter_type_size, &usize);
|
||||
bool released = n->alloc_edata == NULL;
|
||||
emitter_json_kv(&emitter, "released", emitter_type_bool,
|
||||
&released);
|
||||
|
Reference in New Issue
Block a user