Hi Peter, I've applied this to both branches. Thanks for the explanation, it was helpful in trying to figure out what will happen when the trace buffer is filled more quickly than signals arrive. I also had to convince myself that the behaviour is correct when signals outpace new trace entries, and it seems to me that in this case the active trace entry will remain the same across multiple invocations of take_profile_sample() and no allocation is actually necessary due to the early exit.
Attached is a tiny, unrelated change for something I noticed while reviewing: I think we don't need to check for NULL trace buffer keys in take_profile_sample() since the top pointer of that buffer is only ever bumped *after* the whole entry has been populated, so that procedure will never see a NULL value in the "raw" field. Cheers, Evan
>From 0e2fd151c35748270e0f5d818e921bc5bb0a46d8 Mon Sep 17 00:00:00 2001 From: Evan Hanson <[email protected]> Date: Sun, 17 Sep 2017 17:30:18 +1200 Subject: [PATCH] Drop unnecessary check for NULL trace buffer keys --- runtime.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/runtime.c b/runtime.c index 42504d17..93460208 100644 --- a/runtime.c +++ b/runtime.c @@ -4374,10 +4374,8 @@ static void take_profile_sample() tb = trace_buffer_top - 1; } - key = tb->raw; - if (key == NULL) return; /* May happen while in C_trace() */ - /* We could also just hash the pointer but that's a bit trickier */ + key = tb->raw; bp = profile_table + hash_string(C_strlen(key), key, PROFILE_TABLE_SIZE, 0, 0); b = *bp; -- 2.11.0
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
