Repository navigation
Conversation
A service's process in a boot changes name and cgroup after bootchart first sees it. systemd execs its executor through a file descriptor, and the kernel names a task exec'd that way after the descriptor, so journald, logind, udevd and every executor were charted as "9": the name was read once from /proc/PID/sched and refreshed only every Hz/4 samples (250 ms at 200 Hz). The cgroup was read once too, before the process moved from init.scope into its unit, and through cgroup-util, which statfs'd /sys/fs/cgroup before systemd had mounted it and gave up, so every label read "(null)". Now the comm, the command line with -C and the cgroup are read again on every sample in which the process ran, which is when an exec or a move can have happened. The cgroup comes from /proc/PID/cgroup itself: systemd's name=systemd hierarchy on v1 or hybrid, the 0:: line on v2. A process is labelled with its unit, the cgroup path without the slices above it, and a table lists CPU time by unit. /proc/PID/sched, whose start time nothing drew, is no longer read, and cgroup-util goes. --proc samples a directory laid out as /proc, which tests/identity builds and changes under the sampler. The pids are sorted before the tree is built, since the tree needs a parent before its children and only /proc itself lists them in that order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/proc/PID/stat puts the comm in parentheses without quoting it, and bootchart took the parent pid as the fourth word. A comm with a space, such as "Web Content", moved it: the scan failed and the process was never sampled, so it was missing from the chart. The parent pid is now read after the last ')'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The filter dropped a process seen in one sample and one that used less than 1 ms of CPU. In a boot of a few hundred milliseconds that is most of systemd's work: generators, executors, (sd-close) and the like. On spin-stack/machine's boot it dropped 62 processes. A process is now dropped only when it used no CPU time while the chart ran: for one already running at the first sample that saw processes, none past that sample. A process seen in a single sample is drawn over the interval before it, in which it started, with the CPU time it used there; before, its bar had no width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The IO graphs show a boot's bursts, 230 MB/s of reads from 0.1 to 0.14 s on spin-stack/machine's, and nothing said whose they were. read_bytes and write_bytes come from /proc/PID/io on every sample in which the process ran: a process submits a read or dirties a page only while it runs, so a sample in which it did not keeps the last values, and costs no read. Each process's label says what it read and wrote, an orange strip under its bar marks the intervals in which it did, a "Top disk I/O" table lists who did the most, and the unit table sums both by unit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On one vCPU the question a boot chart has to answer is who waited to run. The CPU wait graph sums the run queues' wait, and each process's yellow showed its run delay only past 10% of an interval, with no number anywhere. Three graphs now draw /proc/pressure's cpu, io and memory: the share of each interval in which some task (orange) or every task (red) stalled, from the totals, which unlike the averages are exact over a 5 ms interval. A kernel without PSI draws none. Each process's label, the CPU table and the unit table say how long it waited for a CPU. The run delay was wrong for any process with threads: each thread's run time was added to it in place of the thread's run delay. And the CPU table's total left the threads out, since it was taken before they were added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two boots are compared by numbers, and the SVG holds its numbers only as rectangles. Beside each bootchart-DATE.svg the sampler now writes bootchart-DATE.json: one row per sample of the system's counters as the kernel keeps them, cumulative (schedstat run and wait summed over the CPUs, vmstat's pgpgin and pgpgout, PSI's some and full totals), and each process's pid, parent, name, cgroup, unit, first and last sample, CPU and wait time, bytes read and written, and largest PSS. Rows of numbers under named columns keep it small: 50 KB for 400 samples, against the SVG's 169 KB, sampling a container's /proc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sampler runs on the CPUs it charts, and on spin-stack/machine's one vCPU its time is time the boot did not get: ~12 ms of CPU at 200 Hz. The header now says what the samples cost, in total and per sample, and the JSON carries it as sampler_cpu_ns. It is the sampler's own CPU time up to the last sample, before drawing. Every process's task directory was listed on every sample to add its threads' times. procfs counts a process's threads in that directory's link count, so a process with one thread is now skipped after a stat. Sampling this laptop's ~600 processes, a sample's CPU went from 6.0 and 6.4 ms to 5.3 and 5.4 ms (two interleaved runs of three); a boot's processes are mostly single-threaded, where the saving is larger. As PID 1's child the sampler kept the name the kernel gave init, and the chart listed it as "init" beside the systemd it forked from. It is now "bootchart". The header's command line, a few hundred characters on a VM, is cut to 150, and kept whole in a comment. It is read through --proc, and a missing one leaves the line empty instead of failing the chart. "recorded N total" counts the samples taken, not the most that could have been. The tables of top consumers, which overlapped at 400 px apart once they carried wait and IO amounts, sit 560 px apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bootchart, svg: a quieter header that says what sampling cost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#2 to #7 were stacked, and each merged into the branch below it instead of main (their base change to main did not apply).
jsonnow holds all of them, #7 included; this brings them to main as one merge, with their commits unchanged.🤖 Generated with Claude Code