in reply to performance profiling
use Time::HiRes qw(gettimeofday tv_interval); my $TH = [gettimeofday]; sub report { print $_[0],': ',tv_interval($TH),"\n"; $TH = [gettimeofday]; } A: { ...do things... } report("A"); B: { ...do some other stuff... } report("B"); C: { ...why not more stuff here... ...and some more!... } report("C");
<update>
...and to generate sums of the the times elapsed between checkpoints
my %TH; sub report { $TH{$_[0]} += tv_interval($TH); $TH = [gettimeofday]; } ... print "$_: $TH{$_}\n" for keys %TH;
</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|