libsysprof-capture: add frame type for tracing

This is like sample but has an "enter/exit" flag with it. This can be
useful when you want to provide tracing instead of sampling. We use a
different frame type so that we can denote that this isn't traditional
sampling, and the flag can be used to find the next exit for the current
enter for calculating durations.

The entire stack trace is provided to make things easier on tools
which may want to deal with indirect functions that were not instrumented
but can be unwound. That may allow for tooling to give the user some
insight that it's not *just* this function entering, but some functions
before it were entered too.

This also adds a SysprofTracer instrument which will preload a
libsysprof-tracer-6.so into the process providing the
__cyg_profile_func_enter() and __cyg_profile_func_leave() hooks.
This commit is contained in:
Christian Hergert
2023-06-13 12:11:55 -07:00
parent 81eafb9232
commit 3a94170b0a
17 changed files with 369 additions and 9 deletions

View File

@ -75,6 +75,10 @@ void sysprof_collector_allocate (SysprofCaptureAddress
SYSPROF_AVAILABLE_IN_3_36
void sysprof_collector_sample (SysprofBacktraceFunc backtrace_func,
void *backtrace_data);
SYSPROF_AVAILABLE_IN_ALL
void sysprof_collector_trace (SysprofBacktraceFunc backtrace_func,
void *backtrace_data,
bool entering);
SYSPROF_AVAILABLE_IN_3_36
void sysprof_collector_mark (int64_t time,
int64_t duration,