Did you know that Ninja writes a log to disk after each build?
To see what kinds of files took the longest for your previous build:
cd out/Default # Lives in depot_tools: post_build_ninja_summary.py
You can also set
NINJA_SUMMARIZE_BUILD=1 to have this command run after each
autoninja invocation (also runs ninja with
To generate a Chrome trace of your most recent build:
git clone https://github.com/nico/ninjatracing ninjatracing/ninjatracing out/Default/.ninja_log > trace.json # Then open in https://ui.perfetto.dev/
Our bots run
post_build_ninja_summary.py as well.
Find the trace at:
postprocess_for_goma > upload_log > ninja_log:
gn gen --tracelog trace.jsonto create a trace for
md5_check.pyto optimize incremental builds.
PRINT_BUILD_EXPLANATIONS=1to have these commands log which inputs changed.
ninja -n -d explainto figure out why ninja thinks a target is dirty.
restat=1feature by not updating timestamps on outputs when their contents do not change.