aboutsummaryrefslogtreecommitdiff
path: root/dep/jemalloc/src/prof.c
diff options
context:
space:
mode:
Diffstat (limited to 'dep/jemalloc/src/prof.c')
-rw-r--r--dep/jemalloc/src/prof.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/dep/jemalloc/src/prof.c b/dep/jemalloc/src/prof.c
index 4d7d65db40c..13334cb4c0b 100644
--- a/dep/jemalloc/src/prof.c
+++ b/dep/jemalloc/src/prof.c
@@ -125,7 +125,7 @@ struct prof_thr_node_s {
uint64_t thr_uid;
/* Variable size based on thr_name_sz. */
char name[1];
-};
+};
typedef struct prof_alloc_node_s prof_alloc_node_t;
@@ -388,7 +388,7 @@ prof_log_bt_index(tsd_t *tsd, prof_bt_t *bt) {
new_node->next = NULL;
new_node->index = log_bt_index;
- /*
+ /*
* Copy the backtrace: bt is inside a tdata or gctx, which
* might die before prof_log_stop is called.
*/
@@ -402,7 +402,7 @@ prof_log_bt_index(tsd_t *tsd, prof_bt_t *bt) {
} else {
return node->index;
}
-}
+}
static size_t
prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) {
assert(prof_logging_state == prof_logging_state_started);
@@ -452,7 +452,7 @@ prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) {
* it's being destroyed).
*/
return;
- }
+ }
malloc_mutex_lock(tsd_tsdn(tsd), &log_mtx);
@@ -514,11 +514,11 @@ prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) {
}
label_done:
- malloc_mutex_unlock(tsd_tsdn(tsd), &log_mtx);
+ malloc_mutex_unlock(tsd_tsdn(tsd), &log_mtx);
}
void
-prof_free_sampled_object(tsd_t *tsd, const void *ptr, size_t usize,
+prof_free_sampled_object(tsd_t *tsd, const void *ptr, size_t usize,
prof_tctx_t *tctx) {
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
@@ -1292,7 +1292,7 @@ prof_dump_write(bool propagate_err, const char *s) {
}
}
- if (prof_dump_buf_end + slen <= PROF_DUMP_BUFSIZE) {
+ if (prof_dump_buf_end + slen - i <= PROF_DUMP_BUFSIZE) {
/* Finish writing. */
n = slen - i;
} else {
@@ -1303,6 +1303,7 @@ prof_dump_write(bool propagate_err, const char *s) {
prof_dump_buf_end += n;
i += n;
}
+ assert(i == slen);
return false;
}
@@ -2604,8 +2605,8 @@ static void
prof_log_emit_traces(tsd_t *tsd, emitter_t *emitter) {
emitter_json_array_kv_begin(emitter, "stack_traces");
prof_bt_node_t *bt_node = log_bt_first;
- prof_bt_node_t *bt_old_node;
- /*
+ prof_bt_node_t *bt_old_node;
+ /*
* Calculate how many hex digits we need: twice number of bytes, two for
* "0x", and then one more for terminating '\0'.
*/
@@ -2744,12 +2745,12 @@ prof_log_stop(tsdn_t *tsdn) {
emitter_init(&emitter, emitter_output_json, &prof_emitter_write_cb,
(void *)(&arg));
- emitter_json_object_begin(&emitter);
+ emitter_begin(&emitter);
prof_log_emit_metadata(&emitter);
prof_log_emit_threads(tsd, &emitter);
prof_log_emit_traces(tsd, &emitter);
prof_log_emit_allocs(tsd, &emitter);
- emitter_json_object_end(&emitter);
+ emitter_end(&emitter);
/* Reset global state. */
if (log_tables_initialized) {