summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-08-27 01:35:16 +0200
committerPierre Bourdon <delroth@gmail.com>2018-10-25 02:27:49 +0200
commiteadb4a66a5db5939df89e71a64edf436737c2cbb (patch)
tree794066351de81d955b2a769c6ad30cc1e2e4f116 /Source
parentdc5a678fca5d4fe492cd342f3f681d07e2005af0 (diff)
ThrottleCallback: use microseconds to represent realtime
Using milliseconds doesn't provide a lot of granularity, and we can use all we can get for performance analysis.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/HW/SystemTimers.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp
index 85883acbdc..5d4fe2cf5a 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -200,9 +200,9 @@ static void ThrottleCallback(u64 last_time, s64 cyclesLate)
// Allow the GPU thread to sleep. Setting this flag here limits the wakeups to 1 kHz.
Fifo::GpuMaySleep();
- u32 time = Common::Timer::GetTimeMs();
+ u64 time = Common::Timer::GetTimeUs();
- int diff = (u32)last_time - time;
+ s64 diff = last_time - time;
const SConfig& config = SConfig::GetInstance();
bool frame_limiter = config.m_EmulationSpeed > 0.0f && !Core::GetIsThrottlerTempDisabled();
u32 next_event = GetTicksPerSecond() / 1000;
@@ -210,17 +210,17 @@ static void ThrottleCallback(u64 last_time, s64 cyclesLate)
{
if (config.m_EmulationSpeed != 1.0f)
next_event = u32(next_event * config.m_EmulationSpeed);
- const int max_fallback = config.iTimingVariance;
+ const s64 max_fallback = config.iTimingVariance * 1000;
if (abs(diff) > max_fallback)
{
DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff < 0 ? "slow" : "fast",
abs(diff) - max_fallback);
last_time = time - max_fallback;
}
- else if (diff > 0)
- Common::SleepCurrentThread(diff);
+ else if ((diff / 1000) > 0)
+ Common::SleepCurrentThread(diff / 1000);
}
- CoreTiming::ScheduleEvent(next_event - cyclesLate, et_Throttle, last_time + 1);
+ CoreTiming::ScheduleEvent(next_event - cyclesLate, et_Throttle, last_time + 1000);
}
// split from Init to break a circular dependency between VideoInterface::Init and
@@ -282,7 +282,7 @@ void Init()
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerHalfLine(), et_VI);
CoreTiming::ScheduleEvent(0, et_DSP);
CoreTiming::ScheduleEvent(s_audio_dma_period, et_AudioDMA);
- CoreTiming::ScheduleEvent(0, et_Throttle, Common::Timer::GetTimeMs());
+ CoreTiming::ScheduleEvent(0, et_Throttle, Common::Timer::GetTimeUs());
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerField(), et_PatchEngine);