From 8db3dafe61e2074c6ea51ae25aec255f361e6557 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 1 May 2020 15:47:25 +0200 Subject: improve chattymalloc trace infrastructure * Detect empty entries. * Parse the trace entries using the struct python library * fix realloc accounting * multiple fixes in chattyparser --- src/chattymalloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/chattymalloc.c') diff --git a/src/chattymalloc.c b/src/chattymalloc.c index d89f531..14bde06 100644 --- a/src/chattymalloc.c +++ b/src/chattymalloc.c @@ -95,8 +95,6 @@ static void init_thread() } } - - /*========================================================= * intercepted functions */ @@ -158,11 +156,12 @@ grow_trace() static void write_trace(char func, void* ptr, size_t size, size_t var_arg) { + if (unlikely(tid == 0)) { init_thread(); } - uint64_t idx = __atomic_fetch_add (&next_entry, 1, __ATOMIC_SEQ_CST); + uint64_t idx = __atomic_fetch_add (&next_entry, 1, __ATOMIC_SEQ_CST); if (idx == total_entries - GROWTH_THRESHOLD) { grow_trace(); // wait for growth completion @@ -253,7 +252,6 @@ init() void* malloc(size_t size) { - if (next_malloc == NULL) { if (!initializing) { init(); -- cgit v1.2.3