Re: [PATCH v12 19/19] perf scripts: Add a coverage table

From: Arnaldo Carvalho de Melo

Date: Wed Nov 25 2026 - 13:38:27 EST


On Tue, Nov 24, 2026 at 04:56:29PM -0800, Namhyung Kim wrote:
> On Mon, Nov 23, 2026 at 07:00:24PM -0300, Arnaldo Carvalho de Melo wrote:
> > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> >
> > Render the report of the last coverage run as a table of the files with
> > the most uncovered lines, biggest gap first; --all lists every file and
> > -f picks files explicitly, failing when a requested file has no coverage
> > data. coverage.sh prints the table when a run finishes; it is also wired
> > as 'make -C tools/perf coverage-table', to print just the table. It only
> > reads coverage.sh's report.txt, so the measurement and the table are
> > reviewed and changed separately.
> >
> > For example, with --top 4 on a full test suite run:
> >
> > $ make -C tools/perf coverage-table O=/tmp/build/coverage \
> > COVERAGE_ARGS="--top 4"
> > tools/perf (no tests/ or bench/), 100+ executable lines:
> > the 4 biggest uncovered gaps, start here when adding coverage tests.
> > --all for every file: make -C tools/perf coverage-table O=/tmp/build/coverage COVERAGE_ARGS="--all"
> >
> > ┌──────────────────────────────────────────┬────────┬────────┬────────┬─────────────────────────────┬─────────────┬──────────┐
> > │ File │ Lines │ Hit │ Miss │ Line Coverage │ Funcs │ FuncCov │
> > ├──────────────────────────────────────────┼────────┼────────┼────────┼─────────────────────────────┼─────────────┼──────────┤
> > │ util/intel-pt.c │ 3237 │ 0 │ 3237 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/142 │ 0.00% │
> > │ util/intel-pt-decoder/intel-pt-decoder.c │ 3208 │ 0 │ 3208 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/119 │ 0.00% │
> > │ ui/browsers/hists.c │ 2742 │ 0 │ 2742 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/124 │ 0.00% │
> > │ builtin-sched.c │ 3737 │ 1543 │ 2194 │ ████████░░░░░░░░░░░░ 41.3% │ 62/141 │ 43.97% │
> > ├──────────────────────────────────────────┼────────┼────────┼────────┼─────────────────────────────┼─────────────┼──────────┤
> > │ TOTAL (perf) │ 174097 │ 86374 │ 87723 │ █████████░░░░░░░░░░░ 49.6% │ 5650/9358 │ 60.38% │
> > └──────────────────────────────────────────┴────────┴────────┴────────┴─────────────────────────────┴─────────────┴──────────┘
>
> Maybe you can use similar format both for line and function coverage
> data.

Like this?

⬢ [acme@toolbx perf-tools-next]$ bash tools/perf/scripts/coverage-table.sh --cov-dir=/tmp/opencode/cov-more-cov --top 4
tools/perf (no tests/ or bench/), 100+ executable lines:
the 4 biggest uncovered gaps, start here when adding coverage tests.
--all for every file: make -C tools/perf coverage-table COVERAGE_ARGS="--cov-dir /tmp/opencode/cov-more-cov --all"

┌──────────────────────────────────────────┬───────────────┬───────────────────────────┬───────────────┬───────────────────────────┐
│ File │ Lines │ Coverage │ Funcs │ Coverage │
├──────────────────────────────────────────┼───────────────┼───────────────────────────┼───────────────┼───────────────────────────┤
│ builtin-trace.c │ 155/3661 │ ░░░░░░░░░░░░░░░░░░ 4.2% │ 1/198 │ ░░░░░░░░░░░░░░░░░░ 0.5% │
│ util/intel-pt.c │ 0/3237 │ ░░░░░░░░░░░░░░░░░░ 0.0% │ 0/142 │ ░░░░░░░░░░░░░░░░░░ 0.0% │
│ util/intel-pt-decoder/intel-pt-decoder.c │ 0/3208 │ ░░░░░░░░░░░░░░░░░░ 0.0% │ 0/119 │ ░░░░░░░░░░░░░░░░░░ 0.0% │
│ builtin-sched.c │ 737/3737 │ ███░░░░░░░░░░░░░░░ 19.7% │ 16/141 │ ██░░░░░░░░░░░░░░░░ 11.4% │
├──────────────────────────────────────────┼───────────────┼───────────────────────────┼───────────────┼───────────────────────────┤
│ TOTAL (perf) │ 75546/174407 │ ███████░░░░░░░░░░░ 43.3% │ 5044/9362 │ █████████░░░░░░░░░ 53.9% │
└──────────────────────────────────────────┴───────────────┴───────────────────────────┴───────────────┴───────────────────────────┘
⬢ [acme@toolbx perf-tools-next]$

?

- Arnaldo

> | File | Lines | Coverage | Funcs | Coverage |
> | util/intel-pt.c | 0/3237 | ## 0.0% | 0/142 | ### 0.0% |
> | ...
>
> Thanks,
> Namhyung
>
> >
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > ---