summaryrefslogtreecommitdiff
path: root/src/benchmark.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/benchmark.h')
-rw-r--r--src/benchmark.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/benchmark.h b/src/benchmark.h
index 40bd60240d..bcc07c7dbf 100644
--- a/src/benchmark.h
+++ b/src/benchmark.h
@@ -47,3 +47,9 @@ extern int benchmark_must_finish;
void start_benchmark(struct benchmark_st * st);
double stop_benchmark(struct benchmark_st * st, const char* metric);
+inline static unsigned int
+timespec_sub_ms (struct timespec *a, struct timespec *b)
+{
+ return (a->tv_sec * 1000 + a->tv_nsec / (1000 * 1000) -
+ (b->tv_sec * 1000 + b->tv_nsec / (1000 * 1000)));
+}