Reputation: 654
I've searched the ghc user manual to the best of my ability, but I haven't been able to find a way to have ghc print the timings of each module as it is compiled.
Upvotes: 3
Views: 171
Reputation: 50829
I assume you've found -ddump-timings
which dumps runtime in milliseconds by stage and module? I'm pretty sure your best bet will be to parse its output and sum the times by module.
Looking through the GHC source, the only one piece of code that calls getCPUTime
is in file compiler/GHC/Utils/Error.hs
, function withTiming'
, and this is the output that's enabled by -ddump-timings
. While there could technically be some call to withTiming'
that accounts for the total compilation time of a module, it strikes me as unlikely that it would be disabled by default, and a search for all occurrences of withTiming
in the compiler code base doesn't turn up anything. So, the -ddump-timings
output is probably the best you can do.
Upvotes: 5