diff options
author | David Robillard <d@drobilla.net> | 2020-12-16 16:59:26 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-16 16:59:26 +0100 |
commit | a0a127b5c6395fc402861f95852b9624f9d2621f (patch) | |
tree | ebb8efcb3c132d3e1e17cbaff9bae439c90c5a2f /utils/bench.h | |
parent | 644cf095d12f74c67f323c355dbae0059d02f1f3 (diff) | |
download | lilv-a0a127b5c6395fc402861f95852b9624f9d2621f.tar.gz lilv-a0a127b5c6395fc402861f95852b9624f9d2621f.tar.bz2 lilv-a0a127b5c6395fc402861f95852b9624f9d2621f.zip |
Clean up includes
Diffstat (limited to 'utils/bench.h')
-rw-r--r-- | utils/bench.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/utils/bench.h b/utils/bench.h index 7b8da82..a04996b 100644 --- a/utils/bench.h +++ b/utils/bench.h @@ -23,28 +23,29 @@ #define _POSIX_C_SOURCE 200809L -#include <sys/time.h> #include <time.h> +typedef struct timespec BenchmarkTime; + static inline double -bench_elapsed_s(const struct timespec* start, const struct timespec* end) +bench_elapsed_s(const BenchmarkTime* start, const BenchmarkTime* end) { return ((end->tv_sec - start->tv_sec) + ((end->tv_nsec - start->tv_nsec) * 0.000000001)); } -static inline struct timespec +static inline BenchmarkTime bench_start(void) { - struct timespec start_t; + BenchmarkTime start_t; clock_gettime(CLOCK_REALTIME, &start_t); return start_t; } static inline double -bench_end(const struct timespec* start_t) +bench_end(const BenchmarkTime* start_t) { - struct timespec end_t; + BenchmarkTime end_t; clock_gettime(CLOCK_REALTIME, &end_t); return bench_elapsed_s(start_t, &end_t); } |