Expand description
Per-function instruction profiles, and where a change between two of them went.
A failed gate says “+3.2% instructions”. That is enough to stop a merge and
not enough to fix anything. cachegrind already knows which functions
retired those instructions — the counting run discarded it to /dev/null
— so tak run --profile-dir keeps the profile of the run whose count was
reported, and tak explain ranks the functions whose counts moved. Timing
tools cannot do this: a sampled profile of a 10ms command is mostly noise,
while these counts are as deterministic as the total they add up to.
The cachegrind out format is parsed here rather than handed to cg_diff
or cg_annotate. Both are Python scripts in recent valgrind releases, and
a CI image that installs valgrind for counting need not carry Python.
Profiles never go into git notes. A profile is hundreds of kilobytes, and a
note is a set of one-line records that concurrent writers deduplicate by
exact bytes — see crate::record.
Structs§
- Delta
- One function’s count on both sides.
- Function
- One function’s self cost, and the source files it was charged under.
- Origin
- Where a profile came from, written into it as
desc: tak <key>: <value>lines. - Pair
- A base and a head profile of the same benchmark subject.
- Profile
- A parsed cachegrind out file, reduced to instructions per function.
- Unpaired
- Profiles found on only one side, by their path relative to its directory.
Constants§
- EXTENSION
- What a kept profile’s file name ends in:
<bench>/<subject>plus this. cachegrind’s own default iscachegrind.out.<pid>; the pid is useless here and would stop a base and a head from pairing up by name.
Functions§
- diff
- Every function whose count differs, largest change first.
- load
- Pair up what to explain: two directories
tak run --profile-dirwrote, matched on<bench>/<subject>, or two profile files. - markdown
- Render the attribution as markdown, for a pull request comment or a step
summary beneath
tak compare’s table. - parse
- Parse a cachegrind out file.
- path_
for - Where
tak run --profile-dir DIRkeeps a subject’s profile:DIR/<bench>/<subject>.cachegrind.out. - write
- Write a profile to
dest, with where it came from.