2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:09:55 +02:00
|
|
|
// Refer to the license.txt file included.
|
2012-10-04 05:41:02 +02:00
|
|
|
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2012-10-04 05:41:02 +02:00
|
|
|
|
2014-07-13 13:04:25 +02:00
|
|
|
#include <fstream>
|
|
|
|
|
2017-06-30 09:25:32 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-07-13 13:04:25 +02:00
|
|
|
|
|
|
|
class FPSCounter
|
2014-07-03 02:19:08 +02:00
|
|
|
{
|
2014-07-13 13:04:25 +02:00
|
|
|
public:
|
2016-06-24 10:43:46 +02:00
|
|
|
// Initializes the FPS counter.
|
|
|
|
FPSCounter();
|
2014-07-13 13:04:25 +02:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
// Called when a frame is rendered (updated every second).
|
|
|
|
void Update();
|
2014-07-13 13:04:25 +02:00
|
|
|
|
2017-06-30 09:25:32 +02:00
|
|
|
float GetFPS() const { return m_fps; }
|
2014-07-13 13:04:25 +02:00
|
|
|
private:
|
2017-06-30 09:25:32 +02:00
|
|
|
u64 m_last_time = 0;
|
|
|
|
u64 m_time_since_update = 0;
|
|
|
|
u32 m_frame_counter = 0;
|
|
|
|
float m_fps = 0;
|
2016-06-24 10:43:46 +02:00
|
|
|
std::ofstream m_bench_file;
|
2014-07-09 22:30:34 +02:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
void LogRenderTimeToFile(u64 val);
|
2014-07-13 13:04:25 +02:00
|
|
|
};
|