Page 1 of 1

Basic C++ mouse tester

Posted: 23 Mar 2024, 20:30
by Aeodyn
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:

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

Re: Basic C++ mouse tester

Posted: 23 Mar 2024, 21:05
by pox02
u forgot SetThreadAffinityMask rdtscp is not multicore safe

Re: Basic C++ mouse tester

Posted: 23 Mar 2024, 22:08
by Aeodyn
pox02 wrote:
23 Mar 2024, 21:05
u forgot SetThreadAffinityMask rdtscp is not multicore safe
Thanks! Code look good now? Forgot since I was running it with cmd's `start` for affinity/priority.

Re: Basic C++ mouse tester

Posted: 24 Mar 2024, 00:24
by pox02
Aeodyn wrote:
23 Mar 2024, 22:08
pox02 wrote:
23 Mar 2024, 21:05
u forgot SetThreadAffinityMask rdtscp is not multicore safe
Thanks! Code look good now? Forgot since I was running it with cmd's `start` for affinity/priority.
good

Re: Basic C++ mouse tester

Posted: 24 Mar 2024, 17:27
by BumFlannel
I'm assuming this looks bad?

Image

Re: Basic C++ mouse tester

Posted: 24 Mar 2024, 22:04
by pox02
Aeodyn wrote:
23 Mar 2024, 22:08
pox02 wrote:
23 Mar 2024, 21:05
u forgot SetThreadAffinityMask rdtscp is not multicore safe
Thanks! Code look good now? Forgot since I was running it with cmd's `start` for affinity/priority.
i suggest make it run in first core