Mouse tracking ms precision

For PTB-3 how high is the ms precision when collecting continuous mouse movements? I am currently comparing it to Inquisit software for which it is every 6-7ms and would like to know how much better PTB-3 is when using GetMouse. Thank you!

That is operating system and mouse dependent, but basically as fine-grained as the OS+mouse allows. For collecting continuous mouse movements under the recommended Linux operating system, or on Windows, you’d not use GetMouse though, as that will poll mouse position, so the speed at which you can call GetMouse would be the limiting factor. Instead you’d use the motion recording built into our KbQueue’s support on Linux and Windows. See MouseMotionRecordingDemo.m for how to do this. Each evt struct variable in that demo also has an associated timestamp of when the sample was taken, strangely omitted in that demo - must have forgotten it, but available as evt.Time. As you can see, the syntax here is operating system dependent, slightly different for Linux and Windows for at least some low-level details, and the function is not supported on Apples trainwreck at all.

Mouse devices tell the operating system what their preferred sampling interval is, and the OS typically samples at the smallest power of two <= requested interval, e.g., if the mouse asks for 9 msecs sampling, the OS would go for 8 msecs (2^3).

I think the most common sampling interval is 8 msecs, but there are gaming mice which can go lower than that, maybe 4 or even 2 msecs.

Obviously you can find that out yourself by looking at the delta between evt.Time timestamps in MouseMotionRecordingDemo.m, while moving the mouse continuously.

Actually: Here’s a link to an updated MouseMotionRecordingDemo.m which includes timestamping:

Hope it helps.
-mario

1 Like