ninja-build / ninja

a small build system with a focus on speed
https://ninja-build.org/
Apache License 2.0
11.18k stars 1.59k forks source link

Add a tool to measure the time of each step #2242

Open cjdb opened 1 year ago

cjdb commented 1 year ago

It'd be nice to analyse the time taken (and possibly other stats from Unix's /usr/bin/time) for each job that ninja completes, and have it written to a log file.

$ # Example
$ ninja -t time
$ cat .ninja-time.log
[1/3] clang++ ...
real:
user:
sys:
[2/3] clang++ ...
real:
user:
sys:
[3/3] ld.lld ...
real:
user:
sys:
Hi-Angel commented 1 year ago

In terms of an external utility, apparently there's a ninjatracing tool which converts .ninja_log to Chromium's about:tracing format, so the times taken may be viewed in a browser.

llvee commented 1 month ago

This can be accomplished with linux native features, a cron job. Is this something your team would still like help with?

llvee commented 1 week ago

@cjdb ^ ?

digit-google commented 1 week ago

If you only care about the start/end times, they are already availablein the .ninja_log file, which is what ninjatracing and other tools use. The format is basic enough you can parse it with tools like awk or sed.