summaryrefslogtreecommitdiff
path: root/src/common/windows/timer_resolution.h
diff options
context:
space:
mode:
authorGravatar liamwhite2023-03-07 10:54:13 -0500
committerGravatar GitHub2023-03-07 10:54:13 -0500
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.gz
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.tar.xz
yuzu-a7792e5ff83523142230951ac7eacbd7685dc40b.zip
Merge pull request #9889 from Morph1984/time-is-ticking
core_timing: Reduce CPU usage on Windows
Diffstat (limited to 'src/common/windows/timer_resolution.h')
-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 @@
1// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <chrono>
7
8namespace Common::Windows {
9
10/// Returns the minimum (least precise) supported timer resolution in nanoseconds.
11std::chrono::nanoseconds GetMinimumTimerResolution();
12
13/// Returns the maximum (most precise) supported timer resolution in nanoseconds.
14std::chrono::nanoseconds GetMaximumTimerResolution();
15
16/// Returns the current timer resolution in nanoseconds.
17std::chrono::nanoseconds GetCurrentTimerResolution();
18
19/**
20 * Sets the current timer resolution.
21 *
22 * @param timer_resolution Timer resolution in nanoseconds.
23 *
24 * @returns The current timer resolution.
25 */
26std::chrono::nanoseconds SetCurrentTimerResolution(std::chrono::nanoseconds timer_resolution);
27
28/**
29 * Sets the current timer resolution to the maximum supported timer resolution.
30 *
31 * @returns The current timer resolution.
32 */
33std::chrono::nanoseconds SetCurrentTimerResolutionToMaximum();
34
35/// Sleep for one tick of the current timer resolution.
36void SleepForOneTick();
37
38} // namespace Common::Windows