summaryrefslogtreecommitdiff
path: root/TRNS/support/timer.h
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-05-09 14:45:10 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-05-09 14:45:10 +0200
commit55928ee11b560d4c90ad7362d65794a83e11f659 (patch)
treedf3df5b0a2575191926b583db28b32ba1fc5fe85 /TRNS/support/timer.h
parent1f538b06ecf5dabb642b15c9bbaa890cbd5d2fa9 (diff)
TRNS: Guard dfatool output behind a compile-time flag
Diffstat (limited to 'TRNS/support/timer.h')
-rwxr-xr-xTRNS/support/timer.h26
1 files changed, 19 insertions, 7 deletions
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 <sys/time.h>
+#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