aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/timer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/qps/timer.cc')
-rw-r--r--test/cpp/qps/timer.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc
index 5a5be97071..3c1342041c 100644
--- a/test/cpp/qps/timer.cc
+++ b/test/cpp/qps/timer.cc
@@ -35,9 +35,15 @@
#include <sys/time.h>
#include <sys/resource.h>
+#include <grpc/support/time.h>
Timer::Timer() : start_(Sample()) {}
+double Timer::Now() {
+ auto ts = gpr_now();
+ return ts.tv_sec + 1e-9 * ts.tv_nsec;
+}
+
static double time_double(struct timeval* tv) {
return tv->tv_sec + 1e-6 * tv->tv_usec;
}