So I created "MM.pm", and loaded my top-level module with perl -MMM -MMy::Module -e0. MM shows real time, and cpu for user, system, child user, and child system, and then opens each of the included modules and gives a line count, including a total linecount.
package MM; my @times = (time, times); END { warn sprintf("real %d, user %.2g, sys %.2g, cuser %.2g, csys %.2g\n" +, map { $_ - shift @times } time, times); local *ARGV; @ARGV = sort values %INC; my $sum = 0; while (<>) { next unless eof; warn "$ARGV: $.\n"; $sum += $.; close ARGV; } warn "total: $sum\n"; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: quick startup time profiler
by ysth (Canon) on Sep 18, 2006 at 02:34 UTC | |
|
Re: quick startup time profiler
by Anonymous Monk on Sep 18, 2006 at 03:11 UTC | |
by merlyn (Sage) on Sep 18, 2006 at 12:09 UTC |