HLE: Ignore flip time in syscall stats.

Don't want to count flip timing as the slowest thing, when it happens
inside sceDisplaySetFramebuf (immediate.)
This commit is contained in:
Unknown W. Brackets 2021-08-14 20:18:06 -07:00
parent f530be0969
commit 6f9f9f5f2a
3 changed files with 17 additions and 3 deletions

View File

@ -697,11 +697,15 @@ void *GetQuickSyscallFunc(MIPSOpcode op) {
}
static double hleSteppingTime = 0.0;
void hleSetSteppingTime(double t)
{
void hleSetSteppingTime(double t) {
hleSteppingTime += t;
}
static double hleFlipTime = 0.0;
void hleSetFlipTime(double t) {
hleFlipTime = t;
}
void CallSyscall(MIPSOpcode op)
{
PROFILE_THIS_SCOPE("syscall");
@ -734,8 +738,11 @@ void CallSyscall(MIPSOpcode op)
int funcnum = callno & 0xFFF;
int modulenum = (callno & 0xFF000) >> 12;
double total = time_now_d() - start - hleSteppingTime;
if (total >= hleFlipTime)
total -= hleFlipTime;
_dbg_assert_msg_(total >= 0.0, "Time spent in syscall became negative");
hleSteppingTime = 0.0;
hleFlipTime = 0.0;
updateSyscallStats(modulenum, funcnum, total);
}
}

View File

@ -117,6 +117,8 @@ void hleDebugBreak();
void hleSkipDeadbeef();
// Set time spent in debugger (for more useful debug stats while debugging.)
void hleSetSteppingTime(double t);
// Set time spent in realtime sync.
void hleSetFlipTime(double t);
// Check if the current syscall context is kernel.
bool hleIsKernelMode();
// Enqueue a MIPS function to be called after this HLE call finishes.

View File

@ -972,8 +972,13 @@ void __DisplaySetFramebuf(u32 topaddr, int linesize, int pixelFormat, int sync)
// IMMEDIATE means that the buffer is fine. We can just flip immediately.
// Doing it in non-buffered though creates problems (black screen) on occasion though
// so let's not.
if (!flippedThisFrame && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE)
if (!flippedThisFrame && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) {
double before_flip = time_now_d();
__DisplayFlip(0);
double after_flip = time_now_d();
// Ignore for debug stats.
hleSetFlipTime(after_flip - before_flip);
}
} else {
// Delay the write until vblank
latchedFramebuf = fbstate;