Let's share and compare Windows' ETW MousePacketLatency results

Everything about latency. Tips, testing methods, mouse lag, display lag, game engine lag, network lag, whole input lag chain, VSYNC OFF vs VSYNC ON, and more! Input Lag Articles on Blur Busters.
TooManyPixels
Posts: 52
Joined: 07 Apr 2020, 21:39

Let's share and compare Windows' ETW MousePacketLatency results

Post by TooManyPixels » 02 Nov 2022, 18:51

Apparently Windows' `Microsoft.Windows.Win32kBase.Input` has an ETW trace provider that somehow knows about Windows' end-to-end mouse-pointer latency as measured by Windows' Raw Input Manager ("RIM"), and records them under events like `MouseLatency`, `MousePacketLatency`, `MouseLatencyRandomPick`. and`MouseLatencySummary`.

I note there are also other ETW providers that can help with other events too, such as the event provider for the DWM, which can tell you exactly when it invoked the GPU's driver's `DxgkDdiSetPointerPosition` function, as well as even the (modern-equivalent-of) vblank point - neat (so there's no need to shell-out for a fancy 1000fps video camera now...) .

I know some users here do run and post ETW traces to investigate these input flag issues, but I don't think anyone's yet used the `Microsoft.Windows.Win32kBase.Input` provider yet, so given the amount of placebo cures and vague, poorly-defined symptoms people claim to be experiencing, methinks if people recorded and posted data like this we'd be in a much better position overall.

----------

Instructions:
  1. Be running Windows 10 1903 or later.
  2. Download the 3 files in this repo's subdirectory https://github.com/microsoft/busiotools ... sb/tracing (commit permalink: https://github.com/microsoft/busiotools ... sb/tracing )
  3. Open an elevated cmd.exe and run either (or both) `BusesTrace.cmd` and/or `usbtrace.cmd` - and in the menus choose USB+HID logging. Note that this will not log/trace DWM events.
  4. If you're able to, start another trace separately for DWM events, you should be able to do this from `wprui.exe` with the right profile selected.
  5. Move your mouse such that you can reproduce whatever behaviour-it-is-that-you-don't-like
  6. Stop the traces
  7. Start `wpa.exe` and load your now-saved ETL traces (and don't forget to load Symbols!) and look for events under `Microsoft.Windows.Win32kBase.Input`.
  8. Post a reply to this thread with a screeenshot from WPA and/or relevant data in some copypastable format (i.e. plaintext tabular data (TSV/CSV?) in a preformatted block, I guess?). Important: Do not upload the raw *.etl files because they will very likely contain PII (personally-identifiable-information) about you in them
----------

I'll start with my own:

This is what my trace results look like when my mouse is having a "bad" day (but I've had worse):
198855703-d50e707d-71a7-465f-910e-20607d1ed310.png
198855703-d50e707d-71a7-465f-910e-20607d1ed310.png (567.4 KiB) Viewed 3771 times
198855697-195cd177-b495-478c-980c-aea33c1fdf28.png
198855697-195cd177-b495-478c-980c-aea33c1fdf28.png (567.54 KiB) Viewed 3771 times
I have other traces taken on days when my mouse is feeling better (but still has issues); specifically, on good/"better days" the `CursorRenderLatency` values are significantly better than in that screenshot above.

I still don't have a clue as to the actua underlying cause, and I've been having this problem since late 2019 when this problem started without any obvious cause on a completely different machine - though all my machines have certain common hardware (e.g. Intel Core i7 chips made since 2016, all have ASUS motherboards (but different models) with stock Intel NICs on-board - which are also commonly reported by other people experiencing the same issue.

I'm also wanting to find out if it might be an issue or misconfiguration with USB or HID buffer sizes.

I also shelled-out for a very expensive USB 2.0 protocol analyzer which allowed me to figure out that part of the problem is the host PC waits unnecessarily before issuing USB IN poll requests to the mouse whenever the mouse slows down too much, and that unnecessary wait adds latency - but also that the length of the delay seems to be proportional to the mouse's speed right before it slowed down... or I could be misunderstanding things. Fun.

MegaMelmek
Posts: 235
Joined: 21 Jan 2021, 12:54

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by MegaMelmek » 03 Nov 2022, 07:48

How the hell PC that cant display mouse cursor right, can tell you with instaled software that this is wrong… Only observer from outside this broken PC can tell that…. not broken PC…
If you make square space for mouse and start moving mouse within these walls it has to be transefered on the monitor (there can be some lines). So the mouse pointer has to stay in square space. My mouse pointer is sliding right and down… I think there is no software that can tell you there is something with your mouse movement because PC is thinking that there is all fine…

InputLagger
Posts: 198
Joined: 13 Sep 2021, 12:39
Location: RUS

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by InputLagger » 03 Nov 2022, 11:06

You can also analyse the whole system during lags via this tool snd guide https://ewirch.github.io/2014/03/diagno ... rectx.html

Wanna try many months ago, but I dont have time for this :cry: :cry: :cry:

timecard
Posts: 66
Joined: 25 Jan 2020, 01:10

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by timecard » 03 Nov 2022, 17:45

partial.PNG
partial.PNG (153.96 KiB) Viewed 3440 times
Were you running this while in game?

Also for anyone else instructions are here if it's more clear.
https://github.com/Microsoft/busiotools/tree/master/usb

User avatar
F1zus
Posts: 132
Joined: 07 Nov 2022, 17:59

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by F1zus » 08 Nov 2022, 19:01

Thanks for the program, it really shows real mouse latency. I took small measurements in the evening (when the mouse feels heavy, about 50% input lag) and measured at night (when the mouse glides like on ice, 10% input lag).
That's what I did:
The first one stopped in the evening at 20.31, the mouse felt heavy, I estimate the input lag at 50% of the possible.
The program shows a mouse delay of 160ms.
средний инпут-20-30 время.png
средний инпут-20-30 время.png (250.03 KiB) Viewed 3034 times
The second froze in the dead of night at 02.18. Usually at this time, the input lag almost disappears. The mouse is very sharp, I estimate the input lag at 15%
низкий инпут-02-18время.png
низкий инпут-02-18время.png (228.63 KiB) Viewed 3034 times
The third froze in the dead of night at 02.32. The mouse feels very sharp, as if sliding on ice. I estimate the input lag at 10%.
очень низкий инпут-02-28 время.png
очень низкий инпут-02-28 время.png (201.86 KiB) Viewed 3034 times
These are all input lag measurements for today. I plan to take more measurements in the future. The program really displays the real delay of the mouse.
You just look at the difference between evening and night. In the evening my mouse is heavy and it is difficult for me to play, the delay is 160ms, and at night the mouse slides on ice, the delay is 1.5ms.
It's all due to bad electricity. I don't do anything with the computer, but it's impossible to play during the day and in the evening.

JDoe
Posts: 36
Joined: 14 Feb 2021, 08:03

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by JDoe » 13 Nov 2022, 02:55

Where can I get wpa.exe?

TooManyPixels
Posts: 52
Joined: 07 Apr 2020, 21:39

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by TooManyPixels » 13 Nov 2022, 18:59

F1zus wrote:
08 Nov 2022, 19:01
Thanks for the program, it really shows real mouse latency. I took small measurements in the evening (when the mouse feels heavy, about 50% input lag) and measured at night (when the mouse glides like on ice, 10% input lag).
Does your computer have an Intel XHCI (USB 3) Controller?

TooManyPixels
Posts: 52
Joined: 07 Apr 2020, 21:39

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by TooManyPixels » 13 Nov 2022, 19:00

JDoe wrote:
13 Nov 2022, 02:55
Where can I get wpa.exe?
The download link is at the top of this page: https://learn.microsoft.com/en-us/windo ... e-analyzer

InputLagger
Posts: 198
Joined: 13 Sep 2021, 12:39
Location: RUS

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by InputLagger » 14 Nov 2022, 06:16

F1zus wrote:
08 Nov 2022, 19:01
Thanks for the program, it really shows real mouse latency. I took small measurements in the evening (when the mouse feels heavy, about 50% input lag) and measured at night (when the mouse glides like on ice, 10% input lag).
That's what I did:
The first one stopped in the evening at 20.31, the mouse felt heavy, I estimate the input lag at 50% of the possible.
The program shows a mouse delay of 160ms.
средний инпут-20-30 время.png

The second froze in the dead of night at 02.18. Usually at this time, the input lag almost disappears. The mouse is very sharp, I estimate the input lag at 15%
низкий инпут-02-18время.png

The third froze in the dead of night at 02.32. The mouse feels very sharp, as if sliding on ice. I estimate the input lag at 10%.
очень низкий инпут-02-28 время.png

These are all input lag measurements for today. I plan to take more measurements in the future. The program really displays the real delay of the mouse.
You just look at the difference between evening and night. In the evening my mouse is heavy and it is difficult for me to play, the delay is 160ms, and at night the mouse slides on ice, the delay is 1.5ms.
It's all due to bad electricity. I don't do anything with the computer, but it's impossible to play during the day and in the evening.
Try to ask for hrlp from Microsoft developer / tech / overclockers forums. Maybe users can take more info from these latency logs

User avatar
F1zus
Posts: 132
Joined: 07 Nov 2022, 17:59

Re: Let's share and compare Windows' ETW MousePacketLatency results

Post by F1zus » 15 Nov 2022, 14:09

TooManyPixels wrote:
13 Nov 2022, 18:59
F1zus wrote:
08 Nov 2022, 19:01
Thanks for the program, it really shows real mouse latency. I took small measurements in the evening (when the mouse feels heavy, about 50% input lag) and measured at night (when the mouse glides like on ice, 10% input lag).
Does your computer have an Intel XHCI (USB 3) Controller?
No. My computer is running an amd 5600X processor and an asus b550 tuf gaming plus motherboard.
The processor is overclocked to a frequency of 4.6 GHz at a voltage of 1.26V. It is absolutely stable and cold in all stress tests.
RAM overclocked to 3800cl14. RAM timings are set according to formulas.
AMD Vega56 video card. It does not affect mouse movement in any way.
In the daytime, I observe a lethargic slow mouse.
At night, the mouse becomes very sharp (input lag disappears).

Post Reply