Products › lamco-dsi-tools › Docs › The capture file

The capture file

What a capture holds, its records and their clocks, and how to read one.

A capture is the one document every dsisee command emits and every dsitell command reads, in lamco-dsi-tools (DSI: Desktop session interfaces). dsido writes one too, of what it did. It's JSON: --json prints it on standard output, and --out <file> writes the same document to a file.

A capture holds what the machine said, verbatim. Nothing in it is an interpretation: No state, no verdict, no classification. Those are what dsitell adds when it reads one. This page is a condensed guide. The full reference, with every dissector's record members, is docs/reference/capture-format.md.

Format version

This page describes format version v1, which is the schema_version of every document v0.4.0 and v0.4.1 write. The version changes when a member is renamed, removed or changes meaning. Members that are added don't change it, so a reader has to pass over members it doesn't know. dsitell refuses a document whose schema_version isn't one it reads, and exits 2. A capture in another version is refused whole and never read in part, and the refusal names the version found, the program and version that wrote it, and the versions this build reads.

The envelope

{
  "schema_version": "v1",
  "tool": "dsisee",
  "tool_version": "...",
  "timestamp": "...",
  "host": "example-host",
  "clock": { "machine_id": "...", "boot_id": "...", "instrument_clock_id": 1 },
  "window": { "start": { ... }, "end": { ... }, "spans_two_clocks": false, "uncertainty_ns": null },
  "instrument": { "process_cpu_ns": ... },
  "environment": { "wayland_display": "wayland-1", "xdg_runtime_dir": "/run/user/1000", "present": [ ... ] },
  "dissectors": [ ... ],
  "records": [ ... ]
}
MemberMeaning
schema_versionThe format version, v1. Always first.
tool, tool_versionThe program that took the capture, and its version.
timestampThe wall-clock time the capture was closed, RFC 3339, UTC. It's for a person: No record is stamped with it and nothing is computed from it.
hostThe kernel's host name.
clockWhich clock the instrument's stamps were read from (below).
windowFrom the instrument starting to observe until it stopped, on the instrument's clock.
instrumentWhat taking the capture cost besides elapsed time: process_cpu_ns, and pixel_reading (whether buffers' pixels were read, and what that cost).
environmentWAYLAND_DISPLAY, XDG_RUNTIME_DIR, and present: Which of wayland_socket, session_bus, system_bus, pw_dump and pw_profiler were found. Presence only.
dissectorsEvery dissector the command knew, with its outcome (below).
recordsEvery record, in the order the dissectors ran and each produced them.
streamPresent on a capture that was read from a stream, the form a long run writes.

A command may add members that aren't part of the capture: summary (what a dsisee or dsido command worked out from its own records), health (added by dsisee check, dsitell bundle and dsitell scrub), redaction (by bundle and scrub) and replay (by dsitell replay --out). dsitell passes over all of them and reads the records. Only dsitell replay looks at a stored health, to say where it differs, and it never uses it in place of the records.

A record's index is its position in records, counted from zero. dsitell names records by index, so the order of records is part of a capture and must be kept by anything that rewrites one.

The clock

MemberMeaning
machine_idThe contents of /etc/machine-id, or null.
boot_idThe contents of /proc/sys/kernel/random/boot_id, or null.
instrument_clock_idThe POSIX clock id of the clock every instrument_arrival stamp was read from: 1, CLOCK_MONOTONIC, on Linux. Absent in a capture written before the header recorded it.

CLOCK_MONOTONIC restarts at every boot and is private to one kernel, so stamps from two captures line up only when both identifiers match. An identifier that couldn't be read is null. It's never made up, since an invented one would let two unrelated captures look comparable. instrument_clock_id is what a clock a protocol names by id is compared with: A presentation time the compositor gave is set against an arrival only when the compositor named the same clock id, in every capture involved, on one machine and one boot.

Dissectors and their outcomes

Each entry of dissectors has the dissector's mechanism_id (records carry the same string), its function (session, protocols, capture, input, clipboard, outputs or audio), its transport, its three gates (permission_dialog, needs_privilege, side_effects), its status, its record_count, a detail and how long it took. observe and check list all twenty-one dissectors a full build has.

statusMeaning
ranIt ran and returned its records. Zero records is possible: The dissector looked and there was nothing.
skippedIt wasn't started because a gate is closed. detail says which.
not_availableWhat it reads isn't on this machine: No such bus, socket, program or interface. A faithful negative, not an error.
refusedIt's there and said no, for example a declined permission dialog.
failedIt's there, was reached, and went wrong.
timed_outNo answer arrived within the limit.

A dissector ended for a reason that's the command's and not its own carries cut_short_by: command_time_limit, interrupted (SIGINT), terminated (SIGTERM), and for a long run size_cap, write_failed or until_file. It's asked to stop and has three seconds to hand back what it recorded. One that does keeps its status and its records, and the capture is whole up to the moment it was cut. One that handed nothing back is timed_out with no records, and dsitell health reads it as not examined.

A record

{
  "mechanism_id": "wayland-registry",
  "finding_prefix": "protocols.wayland_registry",
  "member": "wl_registry.global",
  "kind": "event",
  "stamps": [ { "clock": "instrument_arrival", "value_ns": ..., "role": "observed" } ],
  "instrument_arrival_ns": ...,
  "batch_ref": null,
  "correlation": null,
  "resource": { "kind": "global", "id": 41, "phase": "created" },
  "payload": { "map": [ ["name", { "u32": 41 }], ["interface", { "str": "wl_shm" }], ["version", { "u32": 2 }] ] }
}
MemberMeaning
mechanism_id, finding_prefixThe dissector that wrote the record, and its dotted name.
memberThe native name of what was recorded: An event, a request, a property group. Protocol members keep the protocol's own name.
kind"event" (the protocol sent it), "snapshot" (a full read of a state at one moment), or {"op": ...} (something the instrument did, such as a request it sent).
stampsTimes the protocol gave, each with its clock, and the instrument's own stamps.
instrument_arrival_nsWhen the instrument observed it, on instrument_arrival. Every record has it.
batch_refThe group the record belongs to. For screen capture it's the frame's serial.
correlationA key that ties the record to others.
resourceThe long-lived thing the record concerns: kind, id, and phase (created, updated or removed).
payloadThe content, verbatim, as native values.

Native values

A payload is a tree of tagged values. The tag keeps the type the protocol used, so a 32-bit count and a 64-bit one stay different: {"bool": true}, {"u32": 7}, {"u64": 7}, {"i32": -7}, {"i64": -7}, {"f64": 0.5}, {"str": "text"}, {"bytes": [1, 2, 3]}, {"list": [ ... ]}, {"map": [ ["key", value], ... ]} (named fields as a list of pairs, so the protocol's field order survives), {"opaque_res": ...} for a resource that isn't a value, such as a file descriptor, and "null" for the protocol's own "no value". A JSON document a program printed (a pw-dump object, a profiler entry) is recorded by the same rules.

A fact that was looked for and couldn't be read is recorded in place of the value as { "map": [ ["not_read", { "str": "the reason" }] ] }. It's never a default, since an empty string or a zero would read as an observation. A number that a protocol defines as one of an enumeration, or as a set of bits, is recorded as the number (raw) with the protocol's own name or names beside it, and unnamed_bits for set bits that have none. A name is never guessed.

Stamps and clocks

A stamp is one reading of one named clock: clock, value_ns, and a role that says what the time means (observed, requested, presentation and so on).

clockWhat it is
instrument_arrivalThe instrument's own CLOCK_MONOTONIC, read when it observed or did something.
compositor_monotonicA time the compositor gave, on its own clock: A frame's presentation time, or the pts of a screen cast buffer.
kernel_monotonicA time PipeWire reported, or the time the compositor says a frame was presented when it named clock 1 for it.
process_cpu_timeCPU time of the instrument's process. Only in dsitell timing, never in a record.
client_monotonic, wall, noneDefined, and written by no dissector yet.

Two clocks can share units and still count from different starting points. compositor_monotonic and instrument_arrival are both monotonic nanoseconds and are kept apart for that reason: Subtracting one from the other gives a number that looks like a measurement and isn't one. A duration is the two stamps it lies between, with spans_two_clocks and uncertainty_ns. Its length is the end less the start, and only when the two are on one clock. An uncertainty_ns of null means it wasn't estimated, which differs from zero.

A capture written as a stream

A command run with --soak <duration> writes its capture while it runs, as lines of JSON. It's the same capture in another form:

{"schema_version":"v1","opened":{"tool":"dsisee", ... ,"soak":{"command":"capture observe", ... }}}
{"record":{"mechanism_id":"machine-state","member":"machine_state", ...}}
{"record":{"mechanism_id":"wlr-screencopy","member":"capture_output", ...}}
{"closed":{"timestamp":"...","window":{...},"instrument":{...},"dissectors":[...],"ended":"ran_its_length", ... }}

The first line holds what's known of the header before anything is recorded, each record line one record, and the last, closed, the rest of the header with how the run ended (ran_its_length, size_cap, cut_short, fell_short or until_file). A stream with no closed line is read as far as it goes, and a last line that isn't whole JSON is left out. Every dsitell command reads a stream wherever it reads a capture. A long run also records the machine's state (machine-state) and follows the display session (session-state); see Long runs and load.

What a capture never holds

  • A pixel of the screen. With --read-markers, each buffer searched gets a marker_read record with the counter it decoded, where, and a confidence.
  • A sample of sound. The audio watcher records each marker it found.
  • The text of a restore token, only its length and SHA-256.
  • The content of a clipboard selection, only its length and SHA-256, unless --keep-content asks for the first bytes.

It does hold private details: Login names, user, group and session identifiers, the host name, the machine identifier, home directory paths, bus names, addresses and process identifiers. Read a capture before sharing it, or share what dsitell bundle makes of it, after reading that too. See Sharing a capture.