aboutsummaryrefslogtreecommitdiff
path: root/src/common/perf_timer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/perf_timer.cpp')
-rw-r--r--src/common/perf_timer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/perf_timer.cpp b/src/common/perf_timer.cpp
index d287949ba..fc51dc7f7 100644
--- a/src/common/perf_timer.cpp
+++ b/src/common/perf_timer.cpp
@@ -165,4 +165,20 @@ void PerformanceTimer::resume()
paused = false;
}
+void PerformanceTimer::reset()
+{
+ if (paused)
+ ticks = 0;
+ else
+ ticks = get_tick_count();
+}
+
+uint64_t PerformanceTimer::value() const
+{
+ uint64_t v = ticks;
+ if (!paused)
+ v = get_tick_count() - v;
+ return ticks_to_ns(v);
+}
+
}