kernel/user_debugger: Rework profiler flush mechanism.

Instead of taking the sample inside the timer callback
or the flush callback depending, always take it in the timer
callback, for consistency's sake. This should always work
because we try to flush the buffer when it's only 70% full;
in testing I can't recall seeing any dropped ticks.

Also add a flush call in the post_syscall hook, in case
we hit the flush threshhold while profiling in the kernel
and couldn't trigger the flush then.

Seems to significantly reduce "missed" ticks overall,
but there are still wildly inconsistent results and
lots of missing time.

Change-Id: I43a5e9c050a50309329da39f8a2386c3e2b3c0dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7851
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-07-18 16:40:20 +00:00
committed by waddlesplash
parent 05bd1a31dc
commit 6baf6183d0
2 changed files with 62 additions and 35 deletions
+2 -2
View File
@@ -149,8 +149,8 @@ struct thread_debug_info {
// record a variable number of samples per hit
bool profile_kernel;
// record samples in kernel stack frames
bool buffer_full;
// indicates that the sample buffer is full
bool flush_needed;
// indicates that a flush of the sample buffer is needed
union {
bigtime_t interval_left;
// when unscheduled: the time left of the current sampling