From b4415bccc91f54b8e76e1443e90cc4caa36a82fc Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 26 Oct 2024 13:18:52 +0200 Subject: [PATCH] Make query performance counter reproducible --- src/windows-emulator/syscalls.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/windows-emulator/syscalls.cpp b/src/windows-emulator/syscalls.cpp index c8f948eb..a848be4b 100644 --- a/src/windows-emulator/syscalls.cpp +++ b/src/windows-emulator/syscalls.cpp @@ -11,7 +11,7 @@ namespace { - NTSTATUS handle_NtQueryPerformanceCounter(const syscall_context&, + NTSTATUS handle_NtQueryPerformanceCounter(const syscall_context& c, const emulator_object performance_counter, const emulator_object performance_frequency) { @@ -19,9 +19,10 @@ namespace { if (performance_counter) { - performance_counter.access([](LARGE_INTEGER& value) + performance_counter.access([&](LARGE_INTEGER& value) { - QueryPerformanceCounter(&value); + value.QuadPart = static_cast(c.proc.executed_instructions); + //QueryPerformanceCounter(&value); }); } @@ -29,7 +30,8 @@ namespace { performance_frequency.access([](LARGE_INTEGER& value) { - QueryPerformanceFrequency(&value); + value.QuadPart = 10000; + //QueryPerformanceFrequency(&value); }); }