diff options
| author | 2020-02-10 11:20:40 -0400 | |
|---|---|---|
| committer | 2020-06-18 16:29:18 -0400 | |
| commit | e3524d114246a9221c766bdf1992777b208cbd67 (patch) | |
| tree | 1454fe38bdafd94ada74ae5f1209a7466bbf4e78 /src/common/wall_clock.h | |
| parent | Common: Implement WallClock Interface and implement a native clock for x64 (diff) | |
| download | yuzu-e3524d114246a9221c766bdf1992777b208cbd67.tar.gz yuzu-e3524d114246a9221c766bdf1992777b208cbd67.tar.xz yuzu-e3524d114246a9221c766bdf1992777b208cbd67.zip | |
Common: Refactor & Document Wall clock.
Diffstat (limited to 'src/common/wall_clock.h')
| -rw-r--r-- | src/common/wall_clock.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/wall_clock.h b/src/common/wall_clock.h index 6f763d74b..fc34429bb 100644 --- a/src/common/wall_clock.h +++ b/src/common/wall_clock.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <chrono> | 7 | #include <chrono> |
| 8 | #include <memory> | ||
| 8 | 9 | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | 11 | ||
| @@ -12,10 +13,20 @@ namespace Common { | |||
| 12 | 13 | ||
| 13 | class WallClock { | 14 | class WallClock { |
| 14 | public: | 15 | public: |
| 16 | |||
| 17 | /// Returns current wall time in nanoseconds | ||
| 15 | virtual std::chrono::nanoseconds GetTimeNS() = 0; | 18 | virtual std::chrono::nanoseconds GetTimeNS() = 0; |
| 19 | |||
| 20 | /// Returns current wall time in microseconds | ||
| 16 | virtual std::chrono::microseconds GetTimeUS() = 0; | 21 | virtual std::chrono::microseconds GetTimeUS() = 0; |
| 22 | |||
| 23 | /// Returns current wall time in milliseconds | ||
| 17 | virtual std::chrono::milliseconds GetTimeMS() = 0; | 24 | virtual std::chrono::milliseconds GetTimeMS() = 0; |
| 25 | |||
| 26 | /// Returns current wall time in emulated clock cycles | ||
| 18 | virtual u64 GetClockCycles() = 0; | 27 | virtual u64 GetClockCycles() = 0; |
| 28 | |||
| 29 | /// Returns current wall time in emulated cpu cycles | ||
| 19 | virtual u64 GetCPUCycles() = 0; | 30 | virtual u64 GetCPUCycles() = 0; |
| 20 | 31 | ||
| 21 | /// Tells if the wall clock, uses the host CPU's hardware clock | 32 | /// Tells if the wall clock, uses the host CPU's hardware clock |
| @@ -35,6 +46,6 @@ private: | |||
| 35 | bool is_native; | 46 | bool is_native; |
| 36 | }; | 47 | }; |
| 37 | 48 | ||
| 38 | WallClock* CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency); | 49 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency); |
| 39 | 50 | ||
| 40 | } // namespace Common | 51 | } // namespace Common |