Page 1 of 2

Interesting project about mouse/ gamepad latency

PostPosted: 12 May 2019, 16:14
by Simon95
https://hci.ur.de/projects/latency

There is a german project, where they measure the delay between clicking on the mouse and the reaction on the computer. There was a big range from 5ms to 35ms input delay for different logitech mice. I found it on a german tech page and i thought it belongs here. Check it out :)

Re: Interesting project about mouse/ gamepad latency

PostPosted: 12 May 2019, 17:06
by R-W
Hey, author here. Thank you for your interest in this work :)

Here is a direct link to the PDF: https://epub.uni-regensburg.de/40182/1/ ... ersion.pdf

We will update the project page over the next days (just came back from the conference where we presented this research).
Feel free to point out any errors or unanswered questions.

Re: Interesting project about mouse/ gamepad latency

PostPosted: 12 May 2019, 20:41
by Chief Blur Buster
Fantastic research!

mouse-lag-test.jpg
mouse-lag-test.jpg (80.3 KiB) Viewed 584 times


Measuring that part of the latency chain is quite important.

I've sent you a PM, check it out...

Re: Interesting project about mouse/ gamepad latency

PostPosted: 13 May 2019, 03:01
by R-W
Chief Blur Buster wrote:Fantastic research!
Measuring that part of the latency chain is quite important.
I've sent you a PM, check it out...


Thank you :)
But:

Inbox wrote:You are not authorised to read private messages.

Is this intentional behavior for new subscribers?

Re: Interesting project about mouse/ gamepad latency

PostPosted: 13 May 2019, 08:53
by Chief Blur Buster
Ooops!
I keep forgetting this, I had to bump it to minimum 5 posts because of some chinese spambots that registered and spammed everyone on the forums a while back.

Send me an email to mark(at)blurbusters.com as I'd like to cover this at Blur Busters!

Re: Interesting project about mouse/ gamepad latency

PostPosted: 13 May 2019, 11:59
by Sparky
Always good to have more attention on input lag. Glad to see you have a test setup that measures absolute input lag, rather than just a relative measurement between two mice, which is currently the most popular method for this measurement.

1. the user first touches the input device,
2. the user overcomes activation force and triggers a mechanical
switch (~ 20 ms [11]),
3. the mechanical switch closes an electrical circuit,
4. the closed circuit is detected by the device’s controller
chip (~ 1-20 ms),
5. after processing the sensor data the chip puts data into
a USB buffer (~ 1-20 ms),
6. the host computer queries the USB device for new data
(~ 1-10 ms),
7. the device sends data over the wire (0.001 ms),
8. the host computer notifies the OS about new data from
the USB (0.001 ms),
9. the OS has processed the data and made it available to
userland libraries (0.01 ms),
10. user code has received an input event from a userland
library (0.01 ms).



In the model of switch I tested,Step 3 typically takes about 2ms for a "normal" click, but ranges from about 0.5ms to many tens of milliseconds. https://www.overclock.net/forum/375-mic ... st25711039


If the engineer prioritizes latency, and is using double throw switches, steps 4 and 5 combined should take less than 0.1ms. Using single throw switches you have to use delay based debouncing, but press latency can still be low, only releasing the button really needs a long delay. Unfortunately the delay you need to reliably prevent glitches like double clicking on a single click, or releasing during a drag, is long enough that it would interfere with people spamming clicks intentionally. Unless you use the NC contact for debouncing, in which case you don't need any delays.

In your testing did you come across any mice that actually used the normally closed switch contact for debouncing?

Getting a polling interval faster than 1ms is also possible, but impractical. Either you need a USB driver that polls the input device more frequently than the USB spec calls for, or you need to implement a high speed device, which is expensive and overkill.

As for possible improvements: Maybe a mechanical test fixture that uses an accelerometer for the non-usb trigger. This would let you test devices without opening them, include differences in mechanical actuation time, and give a more accurate test of input devices like keyboards, where each button isn't sampled continuously.

Re: Interesting project about mouse/ gamepad latency

PostPosted: 14 May 2019, 09:27
by R-W
Sparky wrote:Always good to have more attention on input lag. Glad to see you have a test setup that measures absolute input lag, rather than just a relative measurement between two mice, which is currently the most popular method for this measurement.
[...]
In the model of switch I tested,Step 3 typically takes about 2ms for a "normal" click, but ranges from about 0.5ms to many tens of milliseconds. https://www.overclock.net/forum/375-mic ... st25711039

Interesting post, thanks!

Sparky wrote:If the engineer prioritizes latency, and is using double throw switches, steps 4 and 5 combined should take less than 0.1ms. Using single throw switches you have to use delay based debouncing, but press latency can still be low, only releasing the button really needs a long delay. Unfortunately the delay you need to reliably prevent glitches like double clicking on a single click, or releasing during a drag, is long enough that it would interfere with people spamming clicks intentionally. Unless you use the NC contact for debouncing, in which case you don't need any delays.

Oh, nice - I didn't know of this method. We haven't yet looked into debouncing or any other aspects of mechanical keypresses. Sounds like an interesting topic.

Sparky wrote:In your testing did you come across any mice that actually used the normally closed switch contact for debouncing?

I don't know. We completely ignored the switches and just looked for their pins on the PCB.

Sparky wrote:Getting a polling interval faster than 1ms is also possible, but impractical. Either you need a USB driver that polls the input device more frequently than the USB spec calls for, or you need to implement a high speed device, which is expensive and overkill.

You are absolutely right. USB high-speed devices can be polled every 125µs subframe, i.e. at 8000 Hz. In practice, we haven't come across an input device that acts as high-speed device (there are certainly ones somewhere). We settled for 1 ms in our tests because that conforms to the USB standard and can be easily set.
Also, the mousepoll/... USB HID parameters on Linux only allow for setting a minimum of 1 ms - and the Linux EHCI USB code also uses 1 ms as the minimum polling interval.
I guess, for some of the really fast devices, using the higher polling rate could make a difference - but we are talking about less than one millisecond.

Sparky wrote:As for possible improvements: Maybe a mechanical test fixture that uses an accelerometer for the non-usb trigger. This would let you test devices without opening them, include differences in mechanical actuation time, and give a more accurate test of input devices like keyboards, where each button isn't sampled continuously.


We tried something like this using a force sensor. With clicky buttons one could easily determine when the button snapped through because the force applied to the button would suddenly be reduced. But with mushy buttons (many keyboards, gamepads - everything with rubber dome switches), you won't get reliable results. Therefore we focused on the electrical part first - but might investigate mechanical button latency some time in the future.

Re: Interesting project about mouse/ gamepad latency

PostPosted: 15 May 2019, 00:00
by Sparky
R-W wrote:We tried something like this using a force sensor. With clicky buttons one could easily determine when the button snapped through because the force applied to the button would suddenly be reduced. But with mushy buttons (many keyboards, gamepads - everything with rubber dome switches), you won't get reliable results. Therefore we focused on the electrical part first - but might investigate mechanical button latency some time in the future.


I was thinking drop a ~200g mass onto the buttons from a fixed height above the button, and triggering when the object first touches the button, rather than when it overcomes the spring.

With minimal changes you could also test motion latency, not just click latency.

Re: Interesting project about mouse/ gamepad latency

PostPosted: 15 May 2019, 08:07
by stl8k
This seems like relevant research:

https://userinterfaces.aalto.fi/neuromechanics/

Re: Interesting project about mouse/ gamepad latency

PostPosted: 15 May 2019, 15:12
by R-W
stl8k wrote:This seems like relevant research:

https://userinterfaces.aalto.fi/neuromechanics/


Indeed. There are a few groups who do/did research on latency in input devices or systems.

See also:

https://www.tactuallabs.com/papers/desi ... UIST12.pdf

http://mjolnir.lille.inria.fr/turbotouc ... UIST15.php