Products › lamco-dsi-tools › Docs › Measuring
Measuring
The closed loops: Input to the event a window receives, input to the captured frame, the clipboard, and audio.
lamco-dsi-tools (DSI: Desktop session interfaces) times what a program on the desktop sees: From an injected input, or a window's commit, to an event delivered to a window or a buffer delivered on a capture route. In other words, what a remote desktop server sees. It measures in software, on the machine's own clock. It isn't input latency or input lag: Nothing here measures light leaving a monitor.
Each measurement is a closed loop. dsido makes something happen and records each step, a dsisee watcher records what arrives, and dsitell pairs the two captures. The loops need every capture taken on one machine since one boot, and dsitell refuses captures that don't name the same machine identifier and boot identifier, with exit code 2.
The clocks
The instrument stamps everything on its own CLOCK_MONOTONIC, and the capture's header names the machine, the boot and the clock id. A protocol's own times (a frame's presentation time, a buffer's pts, a PipeWire time report) are kept on the clock they came from. A duration whose two ends are on different clocks isn't computed: dsitell lists it under "Not computed", with both clocks. Every figure names its clock.
Input to the event a window receives
dsisee input witness --duration 60 --out witness.json & # a window that records what reaches it
dsido wlr inject text "hello" --out inject.json # send input, and record each step
dsitell loop inject.json witness.json # the time from each step to its event
dsisee input witness opens one window and records every keyboard, pointer and touch event the compositor delivers to it, with the event's own time and the instrument's arrival time, and the frame it commits in answer. dsitell loop pairs each step dsido injected with the event the witness recorded for it and gives the time between them as distributions, from the step being requested and from it being sent. Use dsido eis inject on GNOME and KDE, dsido wlr inject on a wlroots compositor, and dsido kernel inject where you can open /dev/uinput.
- An event is paired with a step only when it arrived before the injection capture ended, so a step whose own event never came isn't paired with the next command's. The report counts the events that came after the end.
- A compositor delivers a key only to the window with the focus. When the witness was without the keyboard focus while key steps were sent, as it is behind a permission dialog, the report says so and puts the key steps not seen down to the focus and not to the route.
- The time from an event to the compositor's presentation of the frame that answers it (
loop.delivered_to_presented) is computed only when the compositor named the same clock id the capture header records. Otherwise it's listed as not computed, and the time the window was told of the presentation stands in its place as an upper bound. - For a touch, the report says whether the witness's seat had the touch capability during the injection and whether the witness held a
wl_touchthen.
Input to the captured frame
The loop above ends where an input event reaches a window. What a person at a remote desktop sees ends later, where the changed pixels reach whatever captures the screen. Measuring that takes pixels that say which frame they are, so a window of the toolkit draws a screen marker: A block of 9 by 9 black and white cells in its top left corner, 24 pixels a cell, that encodes the frame's number in 16 bits with a CRC-8 over them. A capture taken with --read-markers looks for it in each buffer and records the number it read, where, and how sure it is. It stores no pixel.
# What a capture route delivers of a changing screen, and when.
dsido screen animate --rate 60 --duration 10 --out animate.json &
dsisee capture probe --read-markers --duration 8 --out capture.json
dsitell glass animate.json capture.json
# An input event, followed to the pixels.
dsisee input witness --markers --duration 30 --out witness.json &
dsisee capture probe --read-markers --duration 20 --out capture.json &
dsido wlr inject text "hello" --out inject.json
dsitell glass inject.json witness.json capture.json
dsido screen animate is in dsido because it changes what the screen shows, at a rate of its own. The witness with --markers is still dsisee's: It paints only its own window, and only in answer to an event the desktop delivered to it.
dsitell glass names the capture route and gives each figure with its clock. The instrument's own stamps are on one clock and give the lengths: From a step being requested to its event being delivered, to the frame committed in answer, to the captured buffer that shows it arriving, and the whole from first to last. The two legs that touch the compositor's presentation time, glass.committed_to_presented and glass.presented_to_captured, are computed only when the compositor named its clock by POSIX id (wp_presentation's clock_id event), each capture's header records the instrument's clock id, the ids are the same number, and the captures name one machine and one boot. The figure's line then says it rests on that check. In every other case the two legs are listed as not computed, with both clocks and the reason. For an animation the report also says which frames the compositor presented and no buffer showed.
DMA-BUFs on the portal route
On the portal route the buffers are often DMA-BUFs. One is read in two cases, and each reading's read_path says which. Where the PipeWire client library mapped it (which it does only when the producer set the MAPPABLE flag), it's read in place. Where the library didn't, and the stream's format is fixed on the linear modifier (0x0), it's read through a small helper crate of the repository, crates/lamco-dmabuf-read, that maps the buffer read-only, copies the rows asked for between a DMA_BUF_IOCTL_SYNC that starts a read and one that ends it, and unmaps. What it copies is searched for the marker and dropped.
Every other DMA-BUF is recorded as not read, with the reason. --modifiers linear asks the compositor for DMA-BUFs in the layout that's read, and --memory-buffers for shared memory, which is another path through the compositor.
dsido screen animate --duration 20 --out animate.json &
dsisee capture probe --route portal --modifiers linear --read-markers --duration 15 --out linear.json
dsitell glass animate.json linear.json
The helper has met a graphics driver's buffers, in two runs on KWin 6.7.4 on a GPU function: On 2026-11-28 it mapped 592 of 592 buffers and every marker was decoded, and on 2026-11-29 it mapped 72 of 72 linear DMA-BUFs, and 22 of 22 input steps were followed to a captured buffer. Whether another driver lets a client map its buffers, and whether the rows are where the stream's stride says, only a run on that driver shows.
The cursor as metadata
A remote desktop server usually asks a screen cast for the cursor beside the frames, so that it can draw and move the cursor without a new frame. --cursor-mode metadata on the portal route asks for that, and the capture says what came:
dsisee capture probe --route portal --cursor-mode metadata --duration 15 --out cursor.json
dsido eis inject move --by 40,0 --out move.json # meanwhile, in another terminal
dsitell timing move.json cursor.json
- How many buffers carried a cursor metadata block, and how many of those name a cursor. A block whose
idis 0 is SPA's "no cursor information here", and is counted apart. - In how many buffers the position differs from the buffer before, and whether the new position came with a frame or in a buffer that holds no bytes, which is how a producer sends a cursor that moved over a screen that didn't change.
- How many buffers carried a bitmap, and how often the image changed. A capture holds the image's size, hotspot, length and SHA-256, never the image.
portal_screencast.cursor.position_interval, which follows the pointer's own motion and is no rate of the display;.image_interval; and.position_to_frame, how long a position that came alone waited for the next frame, which is as long as the screen stays unchanged.- With a capture of a pointer motion
dsidomade meanwhile,portal_screencast.cursor.motion_to_position: From the motion being requested to the first buffer after it whose cursor position differs.
Every time is the arrival of a buffer on the instrument's clock: When a consumer of the stream learned of the cursor, not when it moved. A cast asked for the cursor as metadata whose buffers carry no cursor block raises CAP-013.
The project's record of runs, reconciled on 2026-12-04, has the cursor as metadata on the portal route on KWin 6.8.2 on 2026-11-29: All 20 buffers carried the cursor. Eight pointer moves through the kernel route showed as a change of position in exactly eight buffers. The cursor's image, 32 by 32, came once and was recorded as a hash. The record, through 2026-11-29, has no run of the cursor lines of dsitell timing for such a capture, of CAP-013, or of --cursor-mode metadata on any other desktop.
The clipboard
dsido clipboard set --hold 30 --out set.json & # put marked content on the clipboard
dsisee clipboard observe --read --duration 10 --out watch.json # read it back, by length and SHA-256
dsitell clipboard set.json watch.json # the time from set to received
No capture holds the content, so dsitell clipboard pairs what was set with what was read by the content's length and SHA-256. It gives the time from the selection being asked for to the watcher being told of it, from there to the content having arrived whole, and the round trip. A selection the watcher found already there when it bound (initial) wasn't seen being set, so the two figures that start at the set are left out for it, with the reason: Start the watcher before the set to get them.
The audio loop
Timing a sound from playing to hearing takes a stream at each end, and both need a build with the pipewire feature (the gnu tarball).
dsisee audio stream --duration 10 --expect 5 --out stream.json & # start the watcher first
dsido audio play --repeat 5 --out play.json # then play
wait
dsitell audio play.json stream.json
dsido audio play plays a marker made to be found exactly and not guessed at: A maximum length sequence, the 2047 bits an 11-bit shift register with the feedback polynomial x^11 + x^2 + 1 puts out before it repeats, each bit one chip of plus or minus the level, held for two samples. That's 4094 samples at 48 kHz of faint hiss, by default at -40 dB relative to full scale. Its correlation with itself has one peak one sample wide, so its place in a stream is one sample and not a range. The watcher's detector is a normalized correlation over the last 4094 samples, counted at 0.25 or above. Both streams ask for 48 kHz, one channel, 32-bit float. A stream that settles on another rate isn't searched, and the capture says why: Nothing is resampled.
What dsitell audio reports, each figure with its clock:
- Measured, on the instrument's clock:
audio.played_to_heard, from the buffer that begins a marker being handed to the graph to the marker's first frame arriving at the watcher. The far end is worked out from the arrival of the buffer that holds the marker's first frame plus that frame's offset, so it's uncertain by one buffer period of the monitor stream at worst, and every pair carries that figure.dsisee audio stream --latency <frames>asks the graph for smaller buffers and narrows it. - Reported by PipeWire, and not measured here: The delay each stream gave for itself in its time report (
pw_time.delay). It's listed beside the measured time and never added to it or taken from it. - Not computed: Any duration between a time PipeWire gave and the instrument's arrival time. They're two clocks, and
dsitell timinglists the pair as refused.
dsitell audio also says whether both streams were linked to one node, since a marker played into one sink isn't heard on another's monitor. Neither capture holds any sound.
See also
- Time a key press to the captured frame, the input-to-pixels loop as a task.
- dsitell reference, for
timing,loop,glass,clipboardandaudio. - What has been run, for which loops have been run on which desktop.