diff options
| author | Pavel Barabanov <pavelbarabanov94@gmail.com> | 2025-04-11 18:52:04 +0300 |
|---|---|---|
| committer | MrPurple666 <antoniosacramento666usa@gmail.com> | 2025-04-12 22:54:32 -0300 |
| commit | 70c2439d8c9a0de298395a3adc2ca859f082f000 (patch) | |
| tree | 9287f6b46bedcd25c3f2228dc4c4ef9a8482df4e /src/core/core_timing.cpp | |
| parent | d25bea576212d70fb89e3d4476379a433f818ee1 (diff) | |
Add sync core speed
Diffstat (limited to 'src/core/core_timing.cpp')
| -rw-r--r-- | src/core/core_timing.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 1abfa920c4..3d67ab9f5c 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -14,6 +14,7 @@ #include "common/x64/cpu_wait.h" #endif +#include "common/settings.h" #include "common/microprofile.h" #include "core/core_timing.h" #include "core/hardware_properties.h" @@ -184,10 +185,20 @@ void CoreTiming::ResetTicks() { } u64 CoreTiming::GetClockTicks() const { + u64 fres; if (is_multicore) [[likely]] { - return clock->GetCNTPCT(); + fres = clock->GetCNTPCT(); + } else { + fres = Common::WallClock::CPUTickToCNTPCT(cpu_ticks); + } + + if (Settings::values.sync_core_speed.GetValue()) { + const double ticks = static_cast<double>(fres); + const double speed_limit = static_cast<double>(Settings::values.speed_limit.GetValue())*0.01; + return static_cast<u64>(ticks/speed_limit); + } else { + return fres; } - return Common::WallClock::CPUTickToCNTPCT(cpu_ticks); } u64 CoreTiming::GetGPUTicks() const { |
