Basic C++ mouse tester
Posted: 23 Mar 2024, 20:30
I've adapted a very basic mouse raw input tester in C++: https://gitlab.com/Aeodyn/cpp-rawinput
The main advantages are that it's single-threaded and uses TSC as the clock source plus QPC for wall clock sync, so as long as your CPU is Nehalem (2008) or newer, it should work great.
To use it, double-click it, start moving your mouse, hit the spacebar to start recording, keep moving your mouse, and hit space again to stop recording and write the results to rawinput.csv.
Command line args:
-p [path]: Output to [path] instead of rawinput.csv.
-k [key code]: Use a different virual key code (https://learn.microsoft.com/en-us/windo ... -key-codes) instead of space (0x20).
-b: Busy-wait while recording. Should give better results if it has a core all to itself, worse otherwise. Most games don't busy-wait.
-n: No capture. By default it captures the mouse.
-c [core]: Which cpu/core to lock the thread to. By default it will lock to whatever it starts on. 0-indexed.
To graph it, use the "rel" column as X and the "dt" column as Y, or better do a linear fit to (k,rel) and plot the residuals.
I also recommend merging this to your registry so that Windows doesn't "helpfully" add in some extra threads:
The main advantages are that it's single-threaded and uses TSC as the clock source plus QPC for wall clock sync, so as long as your CPU is Nehalem (2008) or newer, it should work great.
To use it, double-click it, start moving your mouse, hit the spacebar to start recording, keep moving your mouse, and hit space again to stop recording and write the results to rawinput.csv.
Command line args:
-p [path]: Output to [path] instead of rawinput.csv.
-k [key code]: Use a different virual key code (https://learn.microsoft.com/en-us/windo ... -key-codes) instead of space (0x20).
-b: Busy-wait while recording. Should give better results if it has a core all to itself, worse otherwise. Most games don't busy-wait.
-n: No capture. By default it captures the mouse.
-c [core]: Which cpu/core to lock the thread to. By default it will lock to whatever it starts on. 0-indexed.
To graph it, use the "rel" column as X and the "dt" column as Y, or better do a linear fit to (k,rel) and plot the residuals.
I also recommend merging this to your registry so that Windows doesn't "helpfully" add in some extra threads:
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\rawinput.exe]
"MaxLoaderThreads"=dword:00000001