summaryrefslogtreecommitdiffstats
path: root/src/common/windows/timer_resolution.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-03-07 16:54:13 +0100
committerGitHub <noreply@github.com>2023-03-07 16:54:13 +0100
commita7792e5ff83523142230951ac7eacbd7685dc40b (patch)
treea7531c65e2ddec1122fc071d44c8106c48352ce3 /src/common/windows/timer_resolution.h
parentMerge pull request #9890 from Kelebek1/reverb_fix (diff)
parentnative_clock: Round RDTSC frequency to the nearest 1000 (diff)
downloadyuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.gz
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.bz2
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.lz
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.xz
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.zst
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.zip
Diffstat (limited to '')
-rw-r--r--src/common/windows/timer_resolution.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/common/windows/timer_resolution.h b/src/common/windows/timer_resolution.h
new file mode 100644
index 000000000..e1e50a62d
--- /dev/null
+++ b/src/common/windows/timer_resolution.h
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <chrono>
+
+namespace Common::Windows {
+
+/// Returns the minimum (least precise) supported timer resolution in nanoseconds.
+std::chrono::nanoseconds GetMinimumTimerResolution();
+
+/// Returns the maximum (most precise) supported timer resolution in nanoseconds.
+std::chrono::nanoseconds GetMaximumTimerResolution();
+
+/// Returns the current timer resolution in nanoseconds.
+std::chrono::nanoseconds GetCurrentTimerResolution();
+
+/**
+ * Sets the current timer resolution.
+ *
+ * @param timer_resolution Timer resolution in nanoseconds.
+ *
+ * @returns The current timer resolution.
+ */
+std::chrono::nanoseconds SetCurrentTimerResolution(std::chrono::nanoseconds timer_resolution);
+
+/**
+ * Sets the current timer resolution to the maximum supported timer resolution.
+ *
+ * @returns The current timer resolution.
+ */
+std::chrono::nanoseconds SetCurrentTimerResolutionToMaximum();
+
+/// Sleep for one tick of the current timer resolution.
+void SleepForOneTick();
+
+} // namespace Common::Windows