From 55928ee11b560d4c90ad7362d65794a83e11f659 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 9 May 2025 14:45:10 +0200 Subject: TRNS: Guard dfatool output behind a compile-time flag --- TRNS/support/timer.h | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'TRNS/support') diff --git a/TRNS/support/timer.h b/TRNS/support/timer.h index c087931..e04a202 100755 --- a/TRNS/support/timer.h +++ b/TRNS/support/timer.h @@ -35,6 +35,8 @@ #include +#if DFATOOL_TIMING + typedef struct Timer { struct timeval startTime[10]; @@ -43,6 +45,8 @@ typedef struct Timer { } Timer; +#define dfatool_printf(fmt, ...) do { printf(fmt, __VA_ARGS__); } while (0) + void start(Timer *timer, int i, int rep) { if (rep == 0) { @@ -60,15 +64,23 @@ void stop(Timer *timer, int i) (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); } -void print(Timer *timer, int i, int REP) +#else + +#define dfatool_printf(fmt, ...) do {} while (0) + +typedef int Timer; + +void start(Timer *timer, int i, int rep) { - printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); + (void)timer; + (void)i; + (void)rep; } -void printall(Timer *timer, int maxt) +void stop(Timer *timer, int i) { - for (int i = 0; i <= maxt; i++) { - printf(" timer%d_us=%f", i, timer->time[i]); - } - printf("\n"); + (void)timer; + (void)i; } + +#endif -- cgit v1.2.3