+ for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
+ my $ref = $list{$_};
+ $nocalls++;
+ my @list = (sprintf "%10s", $_);
+ foreach my $j (0..9) {
+ my $r = $ref->[$j];
+ if ($r) {
+ $tot[$j] += $r;
+ $r = sprintf("%4d", $r);
+ }
+ else {
+ $r = ' ';
+ }
+ push @list, $r;
+ }
+ push @out, join('|', @list, "");
+ last if $limit && $nocalls >= $limit;
+ }
+
+ $nocalls = sprintf "%10s", "$nocalls calls";
+ @tot = map {$_ ? sprintf("%4d", $_) : ' ' } @tot;
+ push @out, join('|', $nocalls, @tot, "");
+
+ return @out;
+
+}