diff options
| author | Dolphin Bot <dolphin-emu-bot@users.noreply.github.com> | 2014-07-09 18:06:57 +0200 |
|---|---|---|
| committer | Dolphin Bot <dolphin-emu-bot@users.noreply.github.com> | 2014-07-09 18:06:57 +0200 |
| commit | 7b754d6f99e394887869f8b58864a649ea3e9c39 (patch) | |
| tree | a6e1a344f713fe245495a00cda987185b65ac501 /Source/Core/VideoCommon/FPSCounter.cpp | |
| parent | 058f907f91bd15594b998f1d5c11893d2c6dd779 (diff) | |
| parent | 95b579746f80d477eedd2ba43fa403b570620986 (diff) | |
Merge pull request #591 from Armada651/pref_log
FPSCounter: Add "Log render time to file" feature.
Diffstat (limited to 'Source/Core/VideoCommon/FPSCounter.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/FPSCounter.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/FPSCounter.cpp b/Source/Core/VideoCommon/FPSCounter.cpp index 5ebfdd499d..e678abe0b1 100644 --- a/Source/Core/VideoCommon/FPSCounter.cpp +++ b/Source/Core/VideoCommon/FPSCounter.cpp @@ -17,36 +17,44 @@ namespace FPSCounter static unsigned int s_counter = 0; static unsigned int s_fps = 0; static unsigned int s_fps_last_counter = 0; -static unsigned long s_last_update_time = 0; +static Common::Timer s_update_time; + +static Common::Timer s_render_time; static std::ofstream s_bench_file; void Initialize() { s_counter = s_fps_last_counter = 0; s_fps = 0; - s_last_update_time = Common::Timer::GetTimeMs(); + + s_update_time.Update(); + s_render_time.Update(); if (s_bench_file.is_open()) s_bench_file.close(); } -static void LogFPSToFile(unsigned long val) +static void LogRenderTimeToFile(u64 val) { if (!s_bench_file.is_open()) - s_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "fps.txt"); + s_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "render_time.txt"); s_bench_file << StringFromFormat("%lu\n", val); } 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_last_counter = s_counter; - if (g_ActiveConfig.bLogFPSToFile) - LogFPSToFile(s_fps); + } + + if (g_ActiveConfig.bLogRenderTimeToFile) + { + LogRenderTimeToFile(s_render_time.GetTimeDifference()); + s_render_time.Update(); } s_counter++; |
