Implement prof sample hooks "experimental.hooks.prof_sample(_free)".

The added hooks hooks.prof_sample and hooks.prof_sample_free are intended to
allow advanced users to track additional information, to enable new ways of
profiling on top of the jemalloc heap profile and sample features.

The sample hook is invoked after the allocation and backtracing, and forwards
the both the allocation and backtrace to the user hook; the sample_free hook
happens before the actual deallocation, and forwards only the ptr and usz to the
hook.
This commit is contained in:
Qi Wang
2022-11-02 15:17:16 -07:00
committed by Qi Wang
parent a74acb57e8
commit 8580c65f81
7 changed files with 307 additions and 19 deletions

View File

@@ -431,6 +431,8 @@ void
prof_hooks_init() {
prof_backtrace_hook_set(&prof_backtrace_impl);
prof_dump_hook_set(NULL);
prof_sample_hook_set(NULL);
prof_sample_free_hook_set(NULL);
}
void