aboutsummaryrefslogtreecommitdiff
path: root/src/core/core_timing.h
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-05-15 22:06:38 +0200
committercrueter <crueter@eden-emu.dev>2026-05-15 22:06:38 +0200
commit975aa4e2f2128b865ec5738c2704c8d37af6a7b9 (patch)
treefeec00d92e12a8c8644ea1b18769d9b225a75c73 /src/core/core_timing.h
parenta1f9e68f46c729a49eeaec1a81d9ac26145d2509 (diff)
[common] remove ptr indirection on WallClock (#3864)
also devirtualizes manually since compiler doesn't do it with LTO Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3864 Reviewed-by: crueter <crueter@eden-emu.dev>
Diffstat (limited to 'src/core/core_timing.h')
-rw-r--r--src/core/core_timing.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index ae9f56d519..5967c83b57 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
@@ -118,7 +118,7 @@ public:
void Idle();
- s64 GetDowncount() const {
+ s64 GetDowncount() const noexcept {
return downcount;
}
@@ -128,11 +128,8 @@ public:
/// Returns the current GPU tick value.
u64 GetGPUTicks() const;
- /// Returns current time in microseconds.
- std::chrono::microseconds GetGlobalTimeUs() const;
-
- /// Returns current time in nanoseconds.
- std::chrono::nanoseconds GetGlobalTimeNs() const;
+ [[nodiscard]] std::chrono::microseconds GetGlobalTimeUs() const noexcept;
+ [[nodiscard]] std::chrono::nanoseconds GetGlobalTimeNs() const noexcept;
/// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
std::optional<s64> Advance();
@@ -141,13 +138,11 @@ public:
void SetTimerResolutionNs(std::chrono::nanoseconds ns);
#endif
-private:
struct Event;
- void ThreadLoop();
void Reset();
- std::unique_ptr<Common::WallClock> clock;
+ Common::WallClock clock;
s64 global_timer = 0;
@@ -165,11 +160,10 @@ private:
Common::Event pause_event{};
mutable std::mutex basic_lock;
std::mutex advance_lock;
- std::optional<std::jthread> timer_thread;
+ std::jthread timer_thread;
std::atomic<bool> paused{};
std::atomic<bool> paused_set{};
std::atomic<bool> wait_set{};
- std::atomic<bool> shutting_down{};
std::atomic<bool> has_started{};
std::function<void()> on_thread_init{};