Measure flips per second.

This commit is contained in:
Unknown W. Brackets 2013-06-16 23:44:11 -07:00
parent d085c2bc5f
commit 6ff9cf64ca
2 changed files with 15 additions and 4 deletions

View File

@ -121,6 +121,9 @@ static double fps = 0.0;
static double fpsHistory[120];
static size_t fpsHistoryPos = 0;
static size_t fpsHistoryValid = 0;
static int lastNumFlips = 0;
static int numFlips = 0;
static float flips = 0.0f;
void hleEnterVblank(u64 userdata, int cyclesLate);
void hleLeaveVblank(u64 userdata, int cyclesLate);
@ -214,7 +217,8 @@ void __DisplayFireVblank() {
}
void __DisplayGetFPS(float *out_vps, float *out_fps) {
*out_vps = *out_fps = fps;
*out_vps = fps;
*out_fps = flips;
}
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
@ -239,9 +243,12 @@ void CalculateFPS()
if (now >= lastFpsTime + 1.0)
{
fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime);
double frames = (gpuStats.numFrames - lastFpsFrame);
fps = frames / (now - lastFpsTime);
flips = 60.0 * (double) (numFlips - lastNumFlips) / frames;
lastFpsFrame = gpuStats.numFrames;
lastFpsFrame = gpuStats.numFrames;
lastNumFlips = numFlips;
lastFpsTime = now;
fpsHistory[fpsHistoryPos++] = fps;
@ -503,6 +510,10 @@ u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync)
fbstate.pspFramebufLinesize = linesize;
}
if (topaddr != framebuf.topaddr) {
++numFlips;
}
if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE) {
// Write immediately to the current framebuffer parameters
if (topaddr != 0) {

View File

@ -337,7 +337,7 @@ void EmuScreen::render() {
float vps, fps;
__DisplayGetFPS(&vps, &fps);
char fpsbuf[256];
sprintf(fpsbuf, "VPS: %0.1f", vps);
sprintf(fpsbuf, "VPS: %0.1f\nFPS: %0.1f", vps, fps);
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT);
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT);
}