in reply to performance profiling
Combining your request with grep's response, I wonder if you'd want to do something like this:
Then you call it like this:sub section($&) { my $name = shift; my $code = shift; use Benchmark; my $start = Benchmark->new(); $code->(); my $end = Benchmark->new(); print STDERR "Section $name: ", timestr(timediff($end, $start)), "\n +"; }
Warning: completely untested ;-)section A => { ... do things ... }; section B => { ...do some other stuff... } section C => { ...why not more stuff here... ...and some more!... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: performance profiling
by thedoe (Monk) on Sep 25, 2006 at 16:45 UTC |