package TWiki::Bench; use Benchmark qw(:all :hireswallclock); use vars qw( $start $last $summary ); sub start { $last = $start = new Benchmark; $summary = ""; } sub mark { my $mess = shift; my $end = new Benchmark; my $delta = Benchmark::timediff($end, $last); $last = $end; my $abs = Benchmark::timediff($end, $start); $summary .= "
\n$mess + " . Benchmark::timestr($delta) . " (" . Benchmark::timestr($abs) . ")"; } sub report { mark(shift); return $summary; } 1;