From bd09c825218aac9255643b9aa7c75f5ba156038c Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:17:50 -0500 Subject: common: Implement a high resolution steady clock This implementation provides a consistent, high performance, and high resolution clock where/when std::chrono::steady_clock does not provide sufficient precision. --- src/common/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common/CMakeLists.txt') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 56b247ac4..9f5d4c265 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -113,6 +113,8 @@ add_library(common STATIC socket_types.h spin_lock.cpp spin_lock.h + steady_clock.cpp + steady_clock.h stream.cpp stream.h string_util.cpp -- cgit v1.2.3 From 1ed49f92dd56289e6e31a967e602c65ccedd4ff1 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:27:10 -0500 Subject: common: Implement a method to change the Windows timer resolution This utilizes undocumented NtDll functions to change the current timer resolution from the default of 1ms. --- src/common/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/common/CMakeLists.txt') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 9f5d4c265..58ff5f2f3 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -144,6 +144,14 @@ add_library(common STATIC zstd_compression.h ) +if (WIN32) + target_sources(common PRIVATE + windows/timer_resolution.cpp + windows/timer_resolution.h + ) + target_link_libraries(common PRIVATE ntdll) +endif() + if(ARCHITECTURE_x86_64) target_sources(common PRIVATE -- cgit v1.2.3