mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
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:
@ -61,6 +61,7 @@
|
||||
#include "Movie.h"
|
||||
#include "Host.h"
|
||||
#include "BPFunctions.h"
|
||||
#include "FPSCounter.h"
|
||||
|
||||
#include "main.h" // Local
|
||||
#ifdef _WIN32
|
||||
@ -251,6 +252,8 @@ Renderer::Renderer()
|
||||
s_fps=0;
|
||||
s_blendMode = 0;
|
||||
|
||||
InitFPSCounter();
|
||||
|
||||
#if defined HAVE_CG && HAVE_CG
|
||||
g_cgcontext = cgCreateContext();
|
||||
cgGetError();
|
||||
@ -1330,20 +1333,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
}
|
||||
}
|
||||
|
||||
// Place messages on the picture, then copy it to the screen
|
||||
// ---------------------------------------------------------------------
|
||||
// Count FPS.
|
||||
// -------------
|
||||
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();
|
||||
// ---------------------------------------------------------------------
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
Reference in New Issue
Block a user