From b6657c0834c60b994a7f3d474b2aed5173744fbc Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Mon, 27 Sep 2021 22:01:04 +0200 Subject: [PATCH] add non-recursive, faster versions of enter/leave --- libprof.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libprof.h b/libprof.h index 9ce1674..123176d 100644 --- a/libprof.h +++ b/libprof.h @@ -66,6 +66,14 @@ extern uint32_t volatile *prof_tcnt; if(!--prof.rec) prof.elapsed -= *prof_tcnt; \ } +/* Variant of prof_enter()/prof_leave() for non-recursive contexts */ +#define prof_enter_norec(prof) { \ + prof.elapsed += *prof_tcnt; \ +} +#define prof_leave_norec(prof) { \ + prof.elapsed -= *prof_tcnt; \ +} + /* prof_exec(): Measure a single block of code This operation can be used when profiling is not required, and instead libprof is used to measure the performance of a single bit of code. Use it