Implement a simple benchmarking mode which logs FPS to a file

Very useful to compare performance between two builds, check the impact of
a configuration option, etc. FPS log is stored in User/Logs/fps.txt and is
reset each time you launch a game. Only enabled if you check the "Log FPS
to file" option in your graphics settings.

Could be improved a bit: currently logs only every 1s (so you can't really
see small variations), maybe output more infos to the fps.txt like
average/stddev (but Excel/Libreoffice/Google Docs can compute that easily
too).
This commit is contained in:
Pierre Bourdon
2012-10-04 05:41:02 +02:00
parent ac2ce8b16e
commit 8cefcaa94c
11 changed files with 119 additions and 36 deletions

View File

@ -44,6 +44,7 @@
#include "Host.h"
#include "BPFunctions.h"
#include "AVIDump.h"
#include "FPSCounter.h"
namespace DX11
{
@ -338,6 +339,8 @@ Renderer::Renderer()
int x, y, w_temp, h_temp;
s_blendMode = 0;
InitFPSCounter();
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
D3D::Create(EmuWindow::GetWnd());
@ -1143,16 +1146,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
}
// update FPS counter
static int fpscount = 0;
static unsigned long lasttime = 0;
if (Common::Timer::GetTimeMs() - lasttime >= 1000)
{
lasttime = Common::Timer::GetTimeMs();
s_fps = fpscount;
fpscount = 0;
}
if (XFBWrited)
++fpscount;
s_fps = UpdateFPSCounter();
// Begin new frame
// Set default viewport and scissor, for the clear to work correctly