kernel: Let user_debugger take care of tracking syscall runtime.

If we just use the kernel entry time, then the pre-syscall tracing
routine (with a debugger message send) will be counted in the syscall's
runtime.

Makes the output of timing in strace and strace -c much more accurate,
however it won't include the "syscall overhead" (time spent in the
syscall entry routines, etc.) But we already can't account for time
spent in the userland-to-kernel transition, so that should probably
be measured some other way if knowing it is desired.

In fact, on architectures which used the generic syscall dispatcher
(e.g. RISC-V), this is the behavior that already existed. So this just
makes x86 consistent with them.

Change-Id: I8cef6111e478ab49b0584e15575172eea77a8760
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8240
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-09-07 15:31:15 +00:00
committed by waddlesplash
parent 2358db9297
commit 788da26bbc
7 changed files with 44 additions and 56 deletions
+5 -4
View File
@@ -122,8 +122,10 @@ struct thread_debug_info {
// profiling related part; if samples != NULL, the thread is profiled
struct {
bigtime_t interval;
// sampling interval
union {
bigtime_t interval;
bigtime_t syscall_start_time;
};
area_id sample_area;
// cloned sample buffer area
addr_t* samples;
@@ -253,8 +255,7 @@ void init_user_debug();
// debug event callbacks
void user_debug_pre_syscall(uint32 syscall, void *args);
void user_debug_post_syscall(uint32 syscall, void *args, uint64 returnValue,
bigtime_t startTime);
void user_debug_post_syscall(uint32 syscall, void *args, uint64 returnValue);
bool user_debug_exception_occurred(debug_exception_type exception, int signal);
bool user_debug_handle_signal(int signal, struct sigaction *handler,
siginfo_t *info, bool deadly);