summaryrefslogtreecommitdiffstats
path: root/src/core/arm
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-13 04:31:55 +0200
committerGitHub <noreply@github.com>2018-08-13 04:31:55 +0200
commitfecffeb0ddedeef0f6223e8a2c53cca3baac70ad (patch)
treeebd7cbbb35fd07e34f6397cde76027533d7200f4 /src/core/arm
parentMerge pull request #1036 from lioncash/thread (diff)
parentCPU/Timing: Use an approximated amortized amount of ticks when advancing timing. (diff)
downloadyuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar.gz
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar.bz2
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar.lz
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar.xz
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.tar.zst
yuzu-fecffeb0ddedeef0f6223e8a2c53cca3baac70ad.zip
Diffstat (limited to 'src/core/arm')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp11
1 files changed, 10 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 {