diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index d31007beff..be27e632c5 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -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); } } diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index 4f589aaf23..d2a74f9d43 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -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. diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index b0738bc8f4..eaa44a0f2d 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -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;