diff options
author | Subv <subv2112@gmail.com> | 2018-08-13 03:41:28 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-08-13 03:41:28 +0200 |
commit | d9237660429adaa9f549d10e79252a713f1da874 (patch) | |
tree | 6573f68774fbb2e2e7019c1e6c2c5454bf60e899 /src | |
parent | Kernel/SVC: Don't reschedule the current core when creating a new thread. (diff) | |
download | yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar.gz yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar.bz2 yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar.lz yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar.xz yuzu-d9237660429adaa9f549d10e79252a713f1da874.tar.zst yuzu-d9237660429adaa9f549d10e79252a713f1da874.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 11 | ||||
-rw-r--r-- | src/core/core_cpu.cpp | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index ceb3f7683..0996f129c 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -86,7 +86,16 @@ public: } void AddTicks(u64 ticks) override { - CoreTiming::AddTicks(ticks - num_interpreted_instructions); + // Divide the number of ticks by the amount of CPU cores. TODO(Subv): This yields only a + // rough approximation of the amount of executed ticks in the system, it may be thrown off + // if not all cores are doing a similar amount of work. Instead of doing this, we should + // device a way so that timing is consistent across all cores without increasing the ticks 4 + // times. + u64 amortized_ticks = (ticks - num_interpreted_instructions) / Core::NUM_CPU_CORES; + // Always execute at least one tick. + amortized_ticks = std::max<u64>(amortized_ticks, 1); + + CoreTiming::AddTicks(amortized_ticks); num_interpreted_instructions = 0; } u64 GetTicksRemaining() override { diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp index 46a522fcd..3f1c70624 100644 --- a/src/core/core_cpu.cpp +++ b/src/core/core_cpu.cpp @@ -90,6 +90,7 @@ void Cpu::RunLoop(bool tight_loop) { LOG_TRACE(Core, "Core-{} idling", core_index); if (IsMainCore()) { + // TODO(Subv): Only let CoreTiming idle if all 4 cores are idling. CoreTiming::Idle(); CoreTiming::Advance(); } |