summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/FPSCounter.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-07-09 17:03:17 +0200
committerJules Blok <jules.blok@gmail.com>2014-07-09 17:53:31 +0200
commitefeadb7fe9e767c80c6a60731b6c38e02959e5fa (patch)
treed6266c88a4cb0625e1f3616b6b360224732e0195 /Source/Core/VideoCommon/FPSCounter.cpp
parent29873a7c55aef0fe9c461df459671ba43c9f7c17 (diff)
FPSCounter: Add "Log render time to file" feature.
Allows for a more accurate performance measurement.
Diffstat (limited to 'Source/Core/VideoCommon/FPSCounter.cpp')
-rw-r--r--Source/Core/VideoCommon/FPSCounter.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/FPSCounter.cpp b/Source/Core/VideoCommon/FPSCounter.cpp
index 5ebfdd499d..9706982758 100644
--- a/Source/Core/VideoCommon/FPSCounter.cpp
+++ b/Source/Core/VideoCommon/FPSCounter.cpp
@@ -20,17 +20,24 @@ static unsigned int s_fps_last_counter = 0;
static unsigned long s_last_update_time = 0;
static std::ofstream s_bench_file;
+static Common::Timer s_render_time;
+static std::ofstream s_time_file;
+
void Initialize()
{
s_counter = s_fps_last_counter = 0;
s_fps = 0;
s_last_update_time = Common::Timer::GetTimeMs();
+ s_render_time.Update();
+
if (s_bench_file.is_open())
s_bench_file.close();
+ if (s_time_file.is_open())
+ s_time_file.close();
}
-static void LogFPSToFile(unsigned long val)
+static void LogFPSToFile(u64 val)
{
if (!s_bench_file.is_open())
s_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "fps.txt");
@@ -38,6 +45,14 @@ static void LogFPSToFile(unsigned long val)
s_bench_file << StringFromFormat("%lu\n", val);
}
+static void LogRenderTimeToFile(u64 val)
+{
+ if (!s_time_file.is_open())
+ s_time_file.open(File::GetUserPath(D_LOGS_IDX) + "render_time.txt");
+
+ s_time_file << StringFromFormat("%lu\n", val);
+}
+
int Update()
{
if (Common::Timer::GetTimeMs() - s_last_update_time >= FPS_REFRESH_INTERVAL)
@@ -49,6 +64,12 @@ int Update()
LogFPSToFile(s_fps);
}
+ if (g_ActiveConfig.bLogRenderTimeToFile)
+ {
+ LogRenderTimeToFile(s_render_time.GetTimeDifference());
+ s_render_time.Update();
+ }
+
s_counter++;
return s_fps;
}