Measure actual fps (frameskip+unthrottle included), show all three on one line if you choose "both" (which I probably should rename)

Also prevent annoying scrolls in key mapping dialog
This commit is contained in:
Henrik Rydgard 2013-08-19 22:05:55 +02:00
parent b84f1793ab
commit 6ca3b43b9a
5 changed files with 24 additions and 9 deletions

View File

@ -111,6 +111,9 @@ static size_t fpsHistoryPos = 0;
static size_t fpsHistoryValid = 0;
static int lastNumFlips = 0;
static float flips = 0.0f;
static int actualFlips = 0; // taking frameskip into account
static int lastActualFlips = 0;
static float actualFps = 0;
static u64 lastFlipCycles = 0;
void hleEnterVblank(u64 userdata, int cyclesLate);
@ -143,6 +146,12 @@ void __DisplayInit() {
curFrameTime = 0.0;
nextFrameTime = 0.0;
flips = 0;
fps = 0.0;
actualFlips = 0;
lastActualFlips = 0;
lastNumFlips = 0;
fpsHistoryValid = 0;
fpsHistoryPos = 0;
fpsHistoryValid = 0;
@ -206,9 +215,10 @@ void __DisplayFireVblank() {
}
}
void __DisplayGetFPS(float *out_vps, float *out_fps) {
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps) {
*out_vps = fps;
*out_fps = flips;
*out_actual_fps = actualFps;
}
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
@ -226,19 +236,21 @@ void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
*out_vps = *out_fps = avg;
}
void CalculateFPS()
{
void CalculateFPS() {
time_update();
double now = time_now_d();
if (now >= lastFpsTime + 1.0)
{
double frames = (gpuStats.numVBlanks - lastFpsFrame);
actualFps = (actualFlips - lastActualFlips);
fps = frames / (now - lastFpsTime);
flips = 60.0 * (double) (gpuStats.numFlips - lastNumFlips) / frames;
lastFpsFrame = gpuStats.numVBlanks;
lastNumFlips = gpuStats.numFlips;
lastActualFlips = actualFlips;
lastFpsTime = now;
fpsHistory[fpsHistoryPos++] = fps;
@ -427,6 +439,7 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
if (coreState == CORE_RUNNING) {
coreState = CORE_NEXTFRAME;
gpu->CopyDisplayToOutput();
actualFlips++;
}
}

View File

@ -34,5 +34,5 @@ typedef void (*VblankCallback)();
void __DisplayListenVblank(VblankCallback callback);
void __DisplayGetDebugStats(char stats[2048]);
void __DisplayGetFPS(float *out_vps, float *out_fps);
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps);
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps);

View File

@ -179,6 +179,7 @@ void ControlMappingScreen::CreateViews() {
mode->AddChoice("Add");
*/
ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
rightScroll->SetScrollToTop(false);
LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
rightScroll->Add(rightColumn);

View File

@ -501,17 +501,18 @@ void EmuScreen::render() {
}
if (g_Config.iShowFPSCounter) {
float vps, fps;
__DisplayGetFPS(&vps, &fps);
float vps, fps, actual_fps;
__DisplayGetFPS(&vps, &fps, &actual_fps);
char fpsbuf[256];
switch (g_Config.iShowFPSCounter) {
case 1:
sprintf(fpsbuf, "Speed: %0.1f%%", vps / 60.0f * 100.0f); break;
case 2:
sprintf(fpsbuf, "FPS: %0.1f", fps); break;
sprintf(fpsbuf, "FPS: %0.1f", actual_fps); break;
case 3:
sprintf(fpsbuf, "Speed: %0.1f%%\nFPS: %0.1f", vps / 60.0f * 100.0f, fps); break;
sprintf(fpsbuf, "%0.1f/%0.0f (%0.1f%%)", actual_fps, fps, vps / 60.0f * 100.0f); break;
}
ui_draw2d.SetFontScale(0.6f, 0.6f);
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT);
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT);
}

2
native

@ -1 +1 @@
Subproject commit 85d0fc61c546fc28ab351b7be18e96dbe9fc6a3e
Subproject commit ddf5c379c3b2d368031990c81f96a062dc46bee4