Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9f6669593af4719e6b1c2a69636d15b723b3db40
https://github.com/WebKit/WebKit/commit/9f6669593af4719e6b1c2a69636d15b723b3db40
Author: Simon Lewis <[email protected]>
Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths:
A Tools/Scripts/cmake-build-analysis
Log Message:
-----------
[CMake] Add cmake-build-analysis for ninja whole-build profiling
https://bugs.webkit.org/show_bug.cgi?id=313327
Reviewed by BJ Burg.
analyze-ftime-trace answers "why is this translation unit slow?" from clang's
per-TU -ftime-trace output. This adds the macro companion: "why is the whole
ninja invocation slow?" from .ninja_log + build.ninja.
Tools/Scripts/cmake-build-analysis <build-dir>
Reads:
.ninja_log -- per-edge start/end timings (always present, free)
build.ninja -- dependency graph for critical-path computation
Produces:
- Terminal report: wall/CPU/efficiency, top-N slowest edges, by-category
breakdown, serialization windows (intervals where parallelism dropped
below cores/2), and the critical path -- the longest weighted chain
through the dependency DAG, i.e. the wall-time lower bound regardless of
core count and therefore the only list that tells you what to fix.
- <build-dir>/build-analysis.html: a self-contained canvas Gantt. X is wall
time; each row is a greedily-packed parallel slot; box width is edge
duration, colour is category (compile / link / swift / codegen / archive /
dsym / other), white outline marks critical-path edges. A strip across the
top plots jobs-running against a core-count reference line so
serialization reads as a dip rather than something inferred from row
count. Wheel zooms, drag pans, hover names the edge. Canvas (not SVG) so
~35k rectangles stay smooth.
The analysis requires .ninja_log to cover exactly one cold build; the tool
refuses multi-run logs (detected by duplicate outputs in the raw log, or
CPU-seconds > wall x cores after compaction) rather than silently producing a
merged timeline that double-counts. CMake-generated ninja writes
fully-expanded paths in `build` statements, so the dependency graph comes from
a single-pass parse handling $-continuations and path escapes -- no general
ninja-variable evaluator. Phony / restat-skipped edges contribute zero weight
but still propagate the path so an aggregate target doesn't break the chain.
Usage:
rm WebKitBuild/cmake-mac/ASan/.ninja_log
ninja -C WebKitBuild/cmake-mac/ASan
Tools/Scripts/cmake-build-analysis WebKitBuild/cmake-mac/ASan --open
* Tools/Scripts/cmake-build-analysis: Added.
Canonical link: https://commits.webkit.org/312146@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications