diff options
| author | 2023-03-01 20:07:59 -0500 | |
|---|---|---|
| committer | 2023-03-05 02:36:31 -0500 | |
| commit | 7e353082ac79bef59d48602f9196cf804d3dfc4f (patch) | |
| tree | 78e010e8e0217e29f748686c1f99e79133d49a4b /src | |
| parent | wall_clock: Make use of SteadyClock (diff) | |
| download | yuzu-7e353082ac79bef59d48602f9196cf804d3dfc4f.tar.gz yuzu-7e353082ac79bef59d48602f9196cf804d3dfc4f.tar.xz yuzu-7e353082ac79bef59d48602f9196cf804d3dfc4f.zip | |
main: (Windows) Set the current timer resolution to the maximum
Increases the precision of thread sleeps on Windows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f233b065e..c092507f4 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -91,6 +91,9 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual | |||
| 91 | #include "common/microprofile.h" | 91 | #include "common/microprofile.h" |
| 92 | #include "common/scm_rev.h" | 92 | #include "common/scm_rev.h" |
| 93 | #include "common/scope_exit.h" | 93 | #include "common/scope_exit.h" |
| 94 | #ifdef _WIN32 | ||
| 95 | #include "common/windows/timer_resolution.h" | ||
| 96 | #endif | ||
| 94 | #ifdef ARCHITECTURE_x86_64 | 97 | #ifdef ARCHITECTURE_x86_64 |
| 95 | #include "common/x64/cpu_detect.h" | 98 | #include "common/x64/cpu_detect.h" |
| 96 | #endif | 99 | #endif |
| @@ -377,6 +380,12 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan | |||
| 377 | LOG_INFO(Frontend, "Host RAM: {:.2f} GiB", | 380 | LOG_INFO(Frontend, "Host RAM: {:.2f} GiB", |
| 378 | Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB}); | 381 | Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB}); |
| 379 | LOG_INFO(Frontend, "Host Swap: {:.2f} GiB", Common::GetMemInfo().TotalSwapMemory / f64{1_GiB}); | 382 | LOG_INFO(Frontend, "Host Swap: {:.2f} GiB", Common::GetMemInfo().TotalSwapMemory / f64{1_GiB}); |
| 383 | #ifdef _WIN32 | ||
| 384 | LOG_INFO(Frontend, "Host Timer Resolution: {:.4f} ms", | ||
| 385 | std::chrono::duration_cast<std::chrono::duration<f64, std::milli>>( | ||
| 386 | Common::Windows::SetCurrentTimerResolutionToMaximum()) | ||
| 387 | .count()); | ||
| 388 | #endif | ||
| 380 | UpdateWindowTitle(); | 389 | UpdateWindowTitle(); |
| 381 | 390 | ||
| 382 | show(); | 391 | show(); |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 77edd58ca..5f39ece32 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -42,6 +42,8 @@ | |||
| 42 | #include <windows.h> | 42 | #include <windows.h> |
| 43 | 43 | ||
| 44 | #include <shellapi.h> | 44 | #include <shellapi.h> |
| 45 | |||
| 46 | #include "common/windows/timer_resolution.h" | ||
| 45 | #endif | 47 | #endif |
| 46 | 48 | ||
| 47 | #undef _UNICODE | 49 | #undef _UNICODE |
| @@ -314,6 +316,8 @@ int main(int argc, char** argv) { | |||
| 314 | 316 | ||
| 315 | #ifdef _WIN32 | 317 | #ifdef _WIN32 |
| 316 | LocalFree(argv_w); | 318 | LocalFree(argv_w); |
| 319 | |||
| 320 | Common::Windows::SetCurrentTimerResolutionToMaximum(); | ||
| 317 | #endif | 321 | #endif |
| 318 | 322 | ||
| 319 | MicroProfileOnThreadCreate("EmuThread"); | 323 | MicroProfileOnThreadCreate("EmuThread"); |