[render-test] Implement fps benchmarking tests (#15803)
This commit is contained in:
24
include/mbgl/util/monotonic_timer.hpp
Normal file
24
include/mbgl/util/monotonic_timer.hpp
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user