Add modified cygnus hooks
This commit is contained in:
parent
d3bad18e33
commit
3752a970ef
|
@ -0,0 +1,28 @@
|
|||
#include "rvprof_internal.h"
|
||||
|
||||
// Here, we override cygnus function hooks to insert our own profiling logic for all
|
||||
// code parts compiled using -finstrument functions.
|
||||
|
||||
void __cyg_profile_func_enter(void *this_fn, void *call_site){
|
||||
|
||||
if (!g_rvprof.config.enable_hooks) return;
|
||||
|
||||
const char* func_name = rvprof_symbols_lookup(this_fn);
|
||||
rvprof_region_begin(func_name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void __cyg_profile_func_exit(void *this_fn, void *call_site){
|
||||
if (!g_rvprof.config.enable_hooks || !g_rvprof.initialized || g_rvprof.stack_ptr < 0) return;
|
||||
|
||||
const char* func_name = rvprof_symbols_lookup(this_fn);
|
||||
rvprof_region_end(func_name);
|
||||
|
||||
// auto-finalize on main function exit
|
||||
if (rvprof_utils_is_main_function(func_name)) {
|
||||
fprintf(stderr, "RVProf: Auto-finalizing on main() exit\n");
|
||||
rvprof_finalize();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue