System: Consider pending ticks when using global ticks

This commit is contained in:
Stenzek
2024-04-07 19:01:48 +10:00
parent 1782151a7a
commit 71f50566f3
4 changed files with 23 additions and 17 deletions

View File

@ -392,6 +392,11 @@ void System::UpdateOverclock()
UpdateThrottlePeriod();
}
u32 System::GetGlobalTickCounter()
{
return TimingEvents::GetGlobalTickCounter() + CPU::GetPendingTicks();
}
u32 System::GetFrameNumber()
{
return s_frame_number;
@ -2547,7 +2552,7 @@ void System::UpdatePerformanceCounters()
const u32 frames_run = s_frame_number - s_last_frame_number;
const float frames_runf = static_cast<float>(frames_run);
const u32 global_tick_counter = TimingEvents::GetGlobalTickCounter();
const u32 global_tick_counter = GetGlobalTickCounter();
// TODO: Make the math here less rubbish
const double pct_divider =
@ -2605,7 +2610,7 @@ void System::ResetPerformanceCounters()
{
s_last_frame_number = s_frame_number;
s_last_internal_frame_number = s_internal_frame_number;
s_last_global_tick_counter = TimingEvents::GetGlobalTickCounter();
s_last_global_tick_counter = GetGlobalTickCounter();
s_last_cpu_time = s_cpu_thread_handle ? s_cpu_thread_handle.GetCPUTime() : 0;
if (const Threading::Thread* sw_thread = g_gpu->GetSWThread(); sw_thread)
s_last_sw_time = sw_thread->GetCPUTime();