问题
I'm using make --jobs=<num>
to do parallel builds on a multi-core machine.
I want to have a robust method to record how long it takes for a given target to get built using the pre-action, build, post-action model.
This answer says:
Also, start and end times are not all there is to know about how long an action takes, when you are running things in parallel; rule A might take longer that rule B, simply because rule B is running alone while rule A is sharing the processor with rules C through J.
Therefore, in order to have a accurate 'duration to build a target', I have to record the worker thread's percentage of time active and multiply that by the recorded duration of a target to get real duration.
Running make
with --trace
- and --jobs
of course - gives a bunch of these statements whose mapping to OS thread IDs I'm unsure of
Main thread handle = 00000098
I need to be able to map an OS thread ID to a make
thread handle
QUESTIONS
- Are these
thread handle
s internal tomake
or do they correspond to OS thread IDs that I could profile with ProcMon? - How do I go from
make
'sthread handle
s to OS thread IDs?
UPDATE
@Kaz makes a good point about prerequisites: what if some or all or none are made?
Answer: I will take care of that in my parsing of the output. Since I'm make
ing with --print-data-base
I can parse how much of the time spent to build a target was due to target itself vs its prerequisites.
来源:https://stackoverflow.com/questions/39086951/gnu-make-parallel-how-to-record-idle-vs-active-cpu-time-for-a-job