Measure (profile) time spent in each target of a Makefile

Viewed 8709

Is there a way to echo the (system, user, real) time spent in each target of a Makefile recursively when I do make all?

I'd like to benchmark the compilation of a project in a more granular way than just time make all. Ideally, it would echo a tree of the executed target, each one with the time spent in all its dependencies. It'd be great also if it could work with -j (parallel make). And by the way my Makefile is non-recursive (doesn't spawn another make instance for each main targets).

Thanks!

2 Answers

remake --profile is a drop-in replacement for make. It generates a target call tree in a callgrind format.

Related