mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
FPSCounter: Use a Timer for the FPS update time.
This commit is contained in:
@ -17,7 +17,7 @@ namespace FPSCounter
|
|||||||
static unsigned int s_counter = 0;
|
static unsigned int s_counter = 0;
|
||||||
static unsigned int s_fps = 0;
|
static unsigned int s_fps = 0;
|
||||||
static unsigned int s_fps_last_counter = 0;
|
static unsigned int s_fps_last_counter = 0;
|
||||||
static unsigned long s_last_update_time = 0;
|
static Common::Timer s_update_time;
|
||||||
static std::ofstream s_bench_file;
|
static std::ofstream s_bench_file;
|
||||||
|
|
||||||
static Common::Timer s_render_time;
|
static Common::Timer s_render_time;
|
||||||
@ -27,8 +27,8 @@ void Initialize()
|
|||||||
{
|
{
|
||||||
s_counter = s_fps_last_counter = 0;
|
s_counter = s_fps_last_counter = 0;
|
||||||
s_fps = 0;
|
s_fps = 0;
|
||||||
s_last_update_time = Common::Timer::GetTimeMs();
|
|
||||||
|
|
||||||
|
s_update_time.Update();
|
||||||
s_render_time.Update();
|
s_render_time.Update();
|
||||||
|
|
||||||
if (s_bench_file.is_open())
|
if (s_bench_file.is_open())
|
||||||
@ -55,9 +55,9 @@ static void LogRenderTimeToFile(u64 val)
|
|||||||
|
|
||||||
int Update()
|
int Update()
|
||||||
{
|
{
|
||||||
if (Common::Timer::GetTimeMs() - s_last_update_time >= FPS_REFRESH_INTERVAL)
|
if (s_update_time.GetTimeDifference() >= FPS_REFRESH_INTERVAL)
|
||||||
{
|
{
|
||||||
s_last_update_time = Common::Timer::GetTimeMs();
|
s_update_time.Update();
|
||||||
s_fps = s_counter - s_fps_last_counter;
|
s_fps = s_counter - s_fps_last_counter;
|
||||||
s_fps_last_counter = s_counter;
|
s_fps_last_counter = s_counter;
|
||||||
if (g_ActiveConfig.bLogFPSToFile)
|
if (g_ActiveConfig.bLogFPSToFile)
|
||||||
|
Reference in New Issue
Block a user