I need to time how much time each subninja takes to build.
Would there be another way other then time each module?
&
Is there a way to export a $subninja as a variable, like $out?
Sincerely, giorag.
Edit: If adding this as a feature to ninja(timing each submodule build time) would be possible, it would be great!
You could add a phony target (called sub_all
for instance) depending on all the targets defined in your subninja file. Then for timing you can do: time ninja sub_all
My target is not to time the whole build process, but to time each subninja seperately.
The purpose of it, eventually, is to figure out why some subninjas take longer than usual to build
I think I got that. When you pass a target as argument to ninja (like sub_all
) it builds only this target.
You can repeat this process for all your subninja.
You can also have a look to .ninja_log
file, which lists start and end times for all edges in first and second columns.
Does it list it in all versions of ninja? My version of ninja is probably
1.3 or something...
2015-12-28 20:22 GMT+02:00 Ilya Popov [email protected]:
You can also have a look to .ninja_log file, which lists start and end
times for all edges in first and second columns.—
Reply to this email directly or view it on GitHub
https://github.com/ninja-build/ninja/issues/1080#issuecomment-167620057.
I just checked 1.3.4 and it does. What do you see in your .ninja_log
? What does it say in the first line (which is comment)? Is it "# ninja log v5
"?
I'm currently not at my workplace, I'll return an answer tomorrow
2015-12-29 11:54 GMT+02:00 Ilya Popov [email protected]:
In 1.3.4 it does. What do you see in your .ninja_log? What does it say in
the first line (which is comment)? Is it "# ninja log v5"?—
Reply to this email directly or view it on GitHub
https://github.com/ninja-build/ninja/issues/1080#issuecomment-167758376.
See also https://groups.google.com/forum/#!topic/ninja-build/aD82sxwD3_o -- seems more like a support question than an issue in ninja itself, so closing this.
Here's some AWK stuff which shows per-target build time averaged through your build history.
#!/usr/bin/awk -f
!/^#/ {
TIMES[$4] += ($2 - $1)/1000
COUNT[$4] += 1
}
END {
for (TGT in TIMES)
AVG[TGT]=TIMES[TGT]/COUNT[TGT]
asorti(AVG, SORTED, "@val_num_desc")
for (num in SORTED)
print AVG[SORTED[num]] " " SORTED[num]
}
After saving as, say, show-ninja-build-stats
somewhere in your $PATH
and chmod +x
-ing it, you can simply run show-ninja-build-stats < .ninja_log
in your build dir.
Thanks for that tip for checking this log file, @ilyapopov.
Most helpful comment
You can also have a look to
.ninja_log
file, which lists start and end times for all edges in first and second columns.