PROPHET/OS
NAME
trace: in which order the marked paths of the kernel ran, and how long each one took
SYNOPSIS
trace [--tui]
DESCRIPTION
In which order the marked paths of the kernel ran, and how long each one took.
The log says what happened. It does not say in which order the paths ran, which of them overlapped and where the time went, and under a deadline that is the only question that matters. A row here is a span: a path with a begin and an end, the core it ran on, the thread it belongs to, and the distance between its two clock stamps.
Path is the name of the marked place. Five stand in this kernel: sched.switch is the work of a thread switch, prog.call one call out of ring 3 and back, mm.pagefault one page fault, and blk.read and blk.write one request to a disk, measured around the driver and not around the bound check in front of it.
At us is how long after the oldest span of the window this one began, Cycles the difference of its two stamps, and Time us the same in microseconds. A row whose Cycles is - is a span without an end in the window, and it stands out: either the path is still running, or it never came back, and until somebody says which, those are the same picture.
The rows stand in the order of the clock across all cores, and that order is why the line above the table carries clock spread: a stamp is the counter of its own core, the kernel brings the counters together at the start where the hardware lets it, and where it could not, that number is how far two of them may lie apart. Two rows from two cores whose At differ by less than it are not ordered, they are simultaneous.
Beside it stand the numbers that say whether the window can be trusted: how many events the machine has written, how many the rings had to drop, and how many events a core wrote that had no ring at all. A ring holds the newest events of its core and overwrites the oldest, so a long window is a window with a loss, and the loss is named instead of looking like a quiet machine.
The first number is the rows against the spans the kernel counted, N of M. The file is one sheet of 8192 byte, so a full window on eight cores does not fit in it; where it did not, the line says so, and nobody reads a cut table as a whole one.
**It is off by default.** Switch it on with control trace.on 1 and off again with 0; off it costs the kernel one compare per marked path and nothing else. Off, the windows stay readable, which is what somebody who has just switched it off wants.
What is NOT here, named instead of invented: **the cost of one event.** That is a time, and it belongs on a quiet machine, not next to other runs.
The rows come out of /state/trace, which stands behind CAP_CONTROL: whoever reads it sees the innards of the kernel. Without the right the file stays empty, and then this says one line and ends with 1 instead of showing a table of no rows.
--tui takes the whole screen and keeps the rows live; the arrows and the two page keys move, q leaves.
EXAMPLE
$ trace --help trace [--tui] the marked paths of the kernel, in order and with their time --tui live on the whole screen, q leaves