summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorMikko Pulkki <55925868+mpulkki-mapbox@users.noreply.github.com>2019-10-22 12:13:55 +0300
committerGitHub <noreply@github.com>2019-10-22 12:13:55 +0300
commit0ca96fd8a402ae530da72e3955196007a2ec365f (patch)
treec1fc1b6194261bdcf3d3243d75368f7bf396e78a /include/mbgl/util
parentbb0e5ffb2ceea28d386a9ac317ab9e1e81d83b07 (diff)
downloadqtlocation-mapboxgl-0ca96fd8a402ae530da72e3955196007a2ec365f.tar.gz
[render-test] Implement fps benchmarking tests (#15803)
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/monotonic_timer.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/mbgl/util/monotonic_timer.hpp b/include/mbgl/util/monotonic_timer.hpp
new file mode 100644
index 0000000000..bdb167214b
--- /dev/null
+++ b/include/mbgl/util/monotonic_timer.hpp
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <chrono>
+#include <functional>
+#include <mbgl/util/noncopyable.hpp>
+#include <memory>
+
+namespace mbgl {
+namespace util {
+
+class MonotonicTimer {
+public:
+ static std::chrono::duration<double> now();
+
+ template <typename F, typename... Args>
+ inline static std::chrono::duration<double> duration(F&& func, Args&&... args) {
+ auto start = now();
+ func(std::forward<Args>(args)...);
+ return now() - start;
+ }
+};
+
+} // namespace util
+} // namespace mbgl \ No newline at end of file