summaryrefslogtreecommitdiff
path: root/TRNS/support/timer.h
diff options
context:
space:
mode:
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