commit | 0bc608077c7cf0d4e5fc84ef0e754d80d934ac64 | [log] [tgz] |
---|---|---|
author | Bruce Dawson <brucedawson@chromium.org> | Mon Jul 26 16:31:07 2021 -0700 |
committer | Bruce Dawson <brucedawson@chromium.org> | Mon Jul 26 16:31:07 2021 -0700 |
tree | c9a6b3a43cf351f887a6ff2c5f9fa4352b661db9 | |
parent | 3907862a6b2c0dd1c39cc26313c738fcad0769ac [diff] |
Optimize ninja -d stats -d stats enables instrumented profiling of key functions in ninja. However, some of those functions are invoked 6+ million times in a NOP build of Chromium and the cost of measuring those functions dwarfs the cost of the functions. Here is typical -d stats output for a Chromium build: metric count avg (us) total (ms) .ninja parse 6580 4197.5 27619.5 canonicalize str 6240450 0.0 47.3 canonicalize path 6251390 0.0 33.5 lookup node 6339402 0.0 37.2 .ninja_log load 1 176226.0 176.2 .ninja_deps load 1 465407.0 465.4 node stat 168997 8.8 1482.9 depfile load 327 352.7 115.3 99% of the measurements are in three functions. The total measurement cost (per ETW sampled profiling) is 700-1200 ms, which is many times greater than the costs of the functions. With this change typical output looks like this: metric count avg (us) total (ms) .ninja parse 6580 3526.3 23203.2 .ninja_log load 1 227305.0 227.3 .ninja_deps load 1 485693.0 485.7 node stat 168997 9.6 1615.0 depfile load 327 383.1 125.3 This resolves issue #1998.
Ninja is a small build system with a focus on speed. https://ninja-build.org/
See the manual or doc/manual.asciidoc
included in the distribution for background and more details.
Binaries for Linux, Mac, and Windows are available at GitHub. Run ./ninja -h
for Ninja help.
Installation is not necessary because the only required file is the resulting ninja binary. However, to enable features like Bash completion and Emacs and Vim editing modes, some files in misc/ must be copied to appropriate locations.
If you're interested in making changes to Ninja, read CONTRIBUTING.md first.
You can either build Ninja via the custom generator script written in Python or via CMake. For more details see the wiki.
./configure.py --bootstrap
This will generate the ninja
binary and a build.ninja
file you can now use to build Ninja with itself.
cmake -Bbuild-cmake -H. cmake --build build-cmake
The ninja
binary will now be inside the build-cmake
directory (you can choose any other name you like).
To run the unit tests:
./build-cmake/ninja_test