summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-06-06 11:19:16 +0200
committerTom Smeding <tom@tomsmeding.com>2022-06-06 11:19:16 +0200
commit1e8c48386412ea5c75cbb0859df1cb895ee4c732 (patch)
treea20a4e0017ecfbadcbe28d2b83c122a964bd3b0c
parentf152fbbe4d9710ecb5e8c39c27e36319de000548 (diff)
Debug printsdebug
-rw-r--r--cbits/hook.c7
-rw-r--r--test/Main.hs1
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