diff options
| author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-10 14:45:08 -0400 |
|---|---|---|
| committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-18 16:29:21 -0400 |
| commit | 1f7dd36499786d373b143a4437d4c32e077a32aa (patch) | |
| tree | 26d21b113d85c6630f3ff67f7affc7c1b6f508a5 /src/core/core_timing_util.cpp | |
| parent | 3398f701eeac63f3cfcf193f3e9c1ee2f06edb08 (diff) | |
Common/Tests: Address Feedback
Diffstat (limited to 'src/core/core_timing_util.cpp')
| -rw-r--r-- | src/core/core_timing_util.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/core_timing_util.cpp b/src/core/core_timing_util.cpp index f42666b4d..be34b26fe 100644 --- a/src/core/core_timing_util.cpp +++ b/src/core/core_timing_util.cpp @@ -49,9 +49,19 @@ s64 nsToCycles(std::chrono::nanoseconds ns) { return (Hardware::BASE_CLOCK_RATE * ns.count()) / 1000000000; } +u64 msToClockCycles(std::chrono::milliseconds ns) { + const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ); + return Common::Divide128On32(temp, 1000).first; +} + +u64 usToClockCycles(std::chrono::microseconds ns) { + const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ); + return Common::Divide128On32(temp, 1000000).first; +} + u64 nsToClockCycles(std::chrono::nanoseconds ns) { - const u128 temporal = Common::Multiply64Into128(ns.count(), CNTFREQ); - return Common::Divide128On32(temporal, 1000000000).first; + const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ); + return Common::Divide128On32(temp, 1000000000).first; } u64 CpuCyclesToClockCycles(u64 ticks) { |
