From 88187ccc3c34100813b0bccb8062c2810bdff7a2 Mon Sep 17 00:00:00 2001 From: guangli-dai Date: Wed, 18 Feb 2026 17:39:57 -0800 Subject: [PATCH] Fix wrong mutex stats in json-formatted malloc stats During mutex stats emit, derived counters are not emitted for json. Yet the array indexing counter should still be increased to skip derived elements in the output, which was not. This commit fixes it. --- src/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stats.c b/src/stats.c index be70a6fc..22b412bd 100644 --- a/src/stats.c +++ b/src/stats.c @@ -260,10 +260,10 @@ mutex_stats_emit(emitter_t *emitter, emitter_row_t *row, #define OP(counter, type, human, derived, base_counter) \ if (!derived) { \ col = &col_##type[k_##type]; \ - ++k_##type; \ emitter_json_kv(emitter, #counter, EMITTER_TYPE_##type, \ (const void *)&col->bool_val); \ - } + } \ + ++k_##type; MUTEX_PROF_COUNTERS; #undef OP #undef EMITTER_TYPE_uint32_t