diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /unittest/function_trace.c | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'unittest/function_trace.c')
| -rw-r--r-- | unittest/function_trace.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/unittest/function_trace.c b/unittest/function_trace.c new file mode 100644 index 0000000..5ed47a9 --- /dev/null +++ b/unittest/function_trace.c @@ -0,0 +1,36 @@ +#include <stdio.h> + +static FILE *fp_trace; + +void +__attribute__ ((constructor)) +trace_begin (void) +{ + fp_trace = fopen("function_trace.out", "w"); +} + +void +__attribute__ ((destructor)) +trace_end (void) +{ + if(fp_trace != NULL) { + fclose(fp_trace); + } +} + + +void +__cyg_profile_func_enter (void *func, void *caller) +{ + if(fp_trace != NULL) { + fprintf(fp_trace, "e %p %p\n", func, caller); + } +} + +void +__cyg_profile_func_exit (void *func, void *caller) +{ + if(fp_trace != NULL) { + fprintf(fp_trace, "x %p %p\n", func, caller); + } +} |
