Core: Make PerfStats internally locked

More ergonomic to use and will be required for upcoming changes.
This commit is contained in:
Yuri Kunde Schlesner 2017-02-20 13:56:58 -08:00
parent f273959205
commit b285c2a4ed
7 changed files with 25 additions and 16 deletions

View file

@ -5,10 +5,15 @@
#pragma once
#include <chrono>
#include <mutex>
#include "common/common_types.h"
namespace Core {
/**
* Class to manage and query performance/timing statistics. All public functions of this class are
* thread-safe unless stated otherwise.
*/
class PerfStats {
public:
using Clock = std::chrono::high_resolution_clock;
@ -37,6 +42,8 @@ public:
double GetLastFrameTimeScale();
private:
std::mutex object_mutex;
Clock::time_point reset_point = Clock::now();
Clock::time_point frame_begin = reset_point;