Repository navigation
Conversation
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>
Merged
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
spin-stack/machine draws its boot with this fork to see how systemd starts inside a ~300-400 ms VM boot on one vCPU, and to catch regressions release to release. Catching a regression means comparing two boots by numbers. The SVG holds its numbers only as rectangles and labels.
What
Beside each
bootchart-DATE.svgthe sampler writesbootchart-DATE.json:sample_columnsandsampleshold one row per sample, oldest first. Each row has the sample's time on the chart's clock,/proc/schedstatrun and wait time summed over the CPUs (ns),/proc/vmstatpgpgin/pgpgout(KiB), and PSIsome/fulltotals for cpu, io and memory (us). The counters are cumulative, as the kernel keeps them, so a reader takes the differences over the intervals it chooses.processesholds one object per process:pid,ppid,name,cgroup,unit,first_seen,last_seen,cpu_ns,wait_ns,read_bytes,write_bytes,pss_max_kb.version,hz,interval,overrun,relative,cpus.The layout is documented at the top of
src/json.c, and the man page points there. Rows of numbers under named columns keep the file small. 400 samples of a container's/proccame to 50 KB, against the SVG's 169 KB (measured locally).Also in this stack, in #2:
/proc/PID/stat's parent pid is read after the last). A comm with a space ("Web Content") made the process unsampled and missing from the chart. The fixture for this PR hit that bug.Checked
tests/jsonruns over a fixture/procand reads the file back with Python'sjson. It checks the columns and row lengths, the sample order, the counters against the fixture's, and pid 62's name, cgroup, unit, CPU, wait andread_bytes. Pid 62's name issay "hi"\to exercise escaping.make checkpasses under ASan/UBSan with gcc in an Ubuntu 24.04 container. CI covers clang.Stacked on #5.
🤖 Generated with Claude Code