(I think this has been discussed to death already, but I’m gonna post anyway…)
I’d like to be able to measure the latency of my setup. Because I cannot improve what I cannot measure.
The problem to be measured
I know we have:
- input latency (how long between the physical button press until the computer detects it)
- display latency (how long between outputting the video and the image showing on the screen)
- emulation latency (which can vary per core and per host CPU performance, with many settings and tweaks to minimize it)
- game engine latency (some games may take a non-zero amount of frames before reacting on-screen)
- post-processing latency (adding shaders and stuff can take time)
- operating system latency (which is outside of RetroArch’s control)
Some of these I can reduce by changing some settings. Others I can reduce by replacing my hardware (controllers, display), which can get expensive and isn’t always feasible (e.g. although a CRT has the lowest latency, I’m not getting one).
So, I’d like to be able to measure it. Either the total latency, or the individual parts.
Existing research and tools
There is an official Libretro Doc talking about latency, which suggests several settings that can be tweaked. But it doesn’t explain how to measure the latency.
There is a blog post from Recalbox about input lag and latency, where they even created a tiny one-off gadget called Latency Bro.
I’ve seem MiSTer Laggy project for MiSTer FPGA. It requires a (cheap) dedicated hardware sensor and it can measure the output+display latency. I wonder if RetroArch has anything similar.
I’ve seen An input lag investigation, which modifies a USB game controller to add an LED to a button press. Then it uses a 240fps video recording to manually measure the total latency.
I’ve seen an iOS app called Is It Snappy? and an Android app called Frameskip that are able to measure the time between two frames in a video.
I’ve seen MiSTer Controller Latency website and MiSTer Input Latency sheet and Gamepadla databases of controller latency (both wired and wireless). I’ve also seen software to measure controller latency, but that also requires modifying the controller.
I know there are two lag tests in 240p, from the 240p test suite which is available for most emulated systems.
But so far I’ve seen nothing measuring the audio latency. And I wonder if audio output could also be used to help measuring the other kinds of latency.
Game engine latency
The release notes for RetroArch 1.7.2 include the following:
How to check the amount of lag frames a game has
RetroArch has the ability to pause a core and advance it frame by frame. Perform the following steps to determine the amount of lag frames of a game:
- Pause emulation (press ‘p’ button on keyboard).
- Press and hold the jump button on the controller.
- Advance emulation frame by frame (press ‘k’ button on keyboard) until the character jumps.
The number of k presses before you get a reaction should be the number of lag frames you can safely remove with run ahead.
These steps will eliminate the input and output latency, allowing us to isolate the game engine latency. This is similar to how people create Tool-Assisted Speedruns.
Unfortunately, stochastic parrots are outputting these steps without context and claiming it measures something else.
Objective
I want to know:
- How much lag does my TV introduce?
- Does my LCD monitor have less latency than my TV?
- Does the amount of lag change over different video signals? (e.g. HDMI, DisplayPort, VGA, SCART, …)
- How much latency do I get in RetroArch on Linux launched from Steam game mode?
- How much latency do I get in RetroArch on Linux launched from desktop mode?
- How much latency do I get in RetroArch on Lakka?
- How much does the latency change on different computers?
- Can a cheap and underpowered old mini-PC deliver acceptable latency?
- How much does the latency vary per RetroArch core? Should I have different settings for each core?
Question
Do you know anything else regarding measuring latency? Any other tool? Any other approach? Anything not yet mentioned in this topic? Anything that helps achieving the objective of measuring the actual latency of each setup?
Bonus points for easy/fast/precise solutions, because they let us iterate quicker. While recording a video and then analyzing frame-by-frame is doable, it is also tedious and time-consuming. Having quicker measurements makes it easier to observe the effect of each variable.