diff options
Diffstat (limited to 'NW/baselines/gpu/timing.h')
-rw-r--r-- | NW/baselines/gpu/timing.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/NW/baselines/gpu/timing.h b/NW/baselines/gpu/timing.h new file mode 100644 index 0000000..6ef8813 --- /dev/null +++ b/NW/baselines/gpu/timing.h @@ -0,0 +1,22 @@ +#ifndef __TIMING_H__ +#define __TIMING_H__ + +#include <sys/time.h> + +void time_measure_start(struct timeval *tv); +void time_measure_end(struct timeval *tv); + +/* tvsub: ret = x - y. */ +static inline void tvsub(struct timeval *x, + struct timeval *y, + struct timeval *ret) +{ + ret->tv_sec = x->tv_sec - y->tv_sec; + ret->tv_usec = x->tv_usec - y->tv_usec; + if (ret->tv_usec < 0) { + ret->tv_sec--; + ret->tv_usec += 1000000; + } +} + +#endif
\ No newline at end of file |