diff options
-rw-r--r-- | cbits/hook.c | 7 | ||||
-rw-r--r-- | test/Main.hs | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/cbits/hook.c b/cbits/hook.c index 22aa259..697b64f 100644 --- a/cbits/hook.c +++ b/cbits/hook.c @@ -137,6 +137,7 @@ static void hook_callback(const struct GCDetails_ *details) { // mutex is locked from here if (logging_enabled) { + fprintf(stderr, "<hook_callback> gc\n"); if (detlog_length == detlog_capacity) { detlog_capacity = detlog_capacity == 0 ? 128 : 2 * detlog_capacity; detlog = realloc(detlog, detlog_capacity * sizeof(detlog[0])); @@ -152,6 +153,8 @@ static void hook_callback(const struct GCDetails_ *details) { dst->timestamp_nsec = now.tv_nsec; shadow_copy(dst, details); detlog_length++; + } else { + fprintf(stderr, "<hook_callback> gc but not enabled\n"); } if (hook_c_delegate) hook_c_delegate(details); @@ -187,6 +190,8 @@ void copy_log_to_buffer(size_t space_available, char *buffer, size_t *unit_size, return; } + fprintf(stderr, "<copy_log_to_buffer> length = %zu\n", detlog_length); + if (detlog_length == 0) { *num_stored = 0; goto unlock_return; @@ -194,6 +199,8 @@ void copy_log_to_buffer(size_t space_available, char *buffer, size_t *unit_size, const size_t n = min_sz(space_available / sizeof(detlog[0]), detlog_length); + fprintf(stderr, "<copy_log_to_buffer> n = %zu\n", n); + // First copy over the fitting items memcpy(buffer, detlog, n * sizeof(detlog[0])); *unit_size = sizeof(detlog[0]); diff --git a/test/Main.hs b/test/Main.hs index 90e5f90..8a0a81a 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -34,6 +34,7 @@ main = do gclog <- getGCLog when (length gclog == 0) $ fail "GC log was unexpectedly empty" + print gclog when (any ((< enabletm) . detTimestamp) gclog) $ do _ <- fail "Logging was already on before enableGClogging" print enabletm |