FPSCounter: Flush the logs every second and close them when the renderer is shut down.

This commit is contained in:
Jules Blok 2014-07-09 22:30:34 +02:00
parent 1754cbda9d
commit 6def4ead01
3 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,12 @@ void Initialize()
s_bench_file.close();
}
void Shutdown()
{
if (s_bench_file.is_open())
s_bench_file.close();
}
static void LogRenderTimeToFile(u64 val)
{
if (!s_bench_file.is_open())
@ -49,6 +55,7 @@ int Update()
s_update_time.Update();
s_fps = s_counter - s_fps_last_counter;
s_fps_last_counter = s_counter;
s_bench_file.flush();
}
if (g_ActiveConfig.bLogRenderTimeToFile)

View File

@ -9,6 +9,9 @@ namespace FPSCounter
// Initializes the FPS counter.
void Initialize();
// Shutdown the FPS counter by closing the logs.
void Shutdown();
// Called when a frame is rendered. Returns the value to be displayed on
// screen as the FPS counter (updated every second).
int Update();

View File

@ -105,6 +105,8 @@ Renderer::~Renderer()
if (pFrameDump.IsOpen())
pFrameDump.Close();
#endif
FPSCounter::Shutdown();
}
void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma)