2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:09:55 +00:00
|
|
|
// Refer to the license.txt file included.
|
2012-10-04 03:41:02 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2012-10-04 03:41:02 +00:00
|
|
|
|
2014-07-13 11:04:25 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include "Common/Timer.h"
|
|
|
|
|
|
|
|
class FPSCounter
|
2014-07-03 00:19:08 +00:00
|
|
|
{
|
2014-07-13 11:04:25 +00:00
|
|
|
public:
|
|
|
|
// Initializes the FPS counter.
|
|
|
|
FPSCounter();
|
|
|
|
|
|
|
|
// Called when a frame is rendered. Returns the value to be displayed on
|
|
|
|
// screen as the FPS counter (updated every second).
|
|
|
|
int Update();
|
2015-09-29 13:43:03 +00:00
|
|
|
|
|
|
|
unsigned int GetFPS() const { return m_fps; }
|
2014-07-13 11:04:25 +00:00
|
|
|
|
|
|
|
private:
|
2015-09-29 13:47:30 +00:00
|
|
|
unsigned int m_fps = 0;
|
|
|
|
unsigned int m_counter = 0;
|
|
|
|
unsigned int m_fps_last_counter = 0;
|
2014-07-13 11:04:25 +00:00
|
|
|
Common::Timer m_update_time;
|
2012-10-04 03:41:02 +00:00
|
|
|
|
2014-07-13 11:04:25 +00:00
|
|
|
Common::Timer m_render_time;
|
|
|
|
std::ofstream m_bench_file;
|
2014-07-09 20:30:34 +00:00
|
|
|
|
2014-07-13 11:04:25 +00:00
|
|
|
void LogRenderTimeToFile(u64 val);
|
|
|
|
};
|