Next | Making Programs Faster | 79 |
END { # Print out the report select REPORT; my @r; my @line_ranks = sort {$time[$b] <=> $time[$a]} (1 .. $#time); @r[@line_ranks] = (('*') x 10, ('+') x 15, ('-') x 75, ('.') x 150); for (1 .. $#count) { my ($c, $t) = ($count[$_], $time[$_]); my $L = ${"::_<Pod/Parser.pm"}[$_]; chomp $L; $L = substr($L, 0, 54); if ($c) { printf "%4d%s%6d %5.2f %5.2f %-54s\n", $_, $r[$_] || ' ', $c, $t, 100*$t/$total_time, $L; } else { printf "%4d %-54s\n", $_, $L; } } }
The @r thing is a little tricky, but it's just a trick
$r[$N] is a * just when $N is one of the top 10 longest-running lines
It is a + when $N is ranked 11-25
It is a - when $N is ranked 26-100
Next | Copyright © 2003 M. J. Dominus |