diff --git a/src/util/timeutil.cpp b/src/util/timeutil.cpp index 1c24ba1cb..2dba44ccb 100644 --- a/src/util/timeutil.cpp +++ b/src/util/timeutil.cpp @@ -5,6 +5,7 @@ using std::chrono::duration_cast; using std::chrono::high_resolution_clock; using std::chrono::microseconds; +using std::chrono::nanoseconds; timeutil::Timer::Timer() { start = high_resolution_clock::now(); @@ -14,6 +15,11 @@ int64_t timeutil::Timer::stop() { .count(); } +int64_t timeutil::Timer::stopNs() { + return duration_cast(high_resolution_clock::now() - start) + .count(); +} + timeutil::ScopeLogTimer::ScopeLogTimer(long long id) : scopeid_(id) { } diff --git a/src/util/timeutil.hpp b/src/util/timeutil.hpp index 514e745c1..2aa71187b 100644 --- a/src/util/timeutil.hpp +++ b/src/util/timeutil.hpp @@ -10,6 +10,7 @@ namespace timeutil { public: Timer(); int64_t stop(); + int64_t stopNs(); }; /**