bunch of improvements from Len. more to follow tomorrow during superbowl.

This commit is contained in:
Matthew Wilson 2006-02-04 23:37:14 +00:00
parent 31fc1bdd17
commit 175622c23e

View file

@ -244,6 +244,7 @@ per sub, descending.
=cut =cut
sub results { sub results {
my @parents;
my $output = qq| my $output = qq|
<script> <script>
function showhide(id){ function showhide(id){
@ -262,18 +263,44 @@ obj.style.display = "none";
$output .= '<i>Function calls: '.scalar(@subTimes).' took: '.$total.'s</i><br><br>'; $output .= '<i>Function calls: '.scalar(@subTimes).' took: '.$total.'s</i><br><br>';
for(my $entry=0;$entry <= $#subTimes;$entry++) { for(my $entry=0;$entry <= $#subTimes;$entry++) {
my $call = $subTimes[$entry]; my $call = $subTimes[$entry];
$call->{entry} = $entry;
$call->{duration} = $call->{end} - $call->{start}; $call->{duration} = $call->{end} - $call->{start};
$output .= "\n".'&nbsp;&nbsp;&nbsp;&nbsp;'; $call->{excl} = $call->{duration};
$output .= '&nbsp;|&nbsp;' for(2..$call->{depth}); if (defined $parents[0]) {
if($subTimes[$entry + 1] && ($subTimes[$entry + 1]->{depth} > $call->{depth})) { $subTimes[$parents[-1]]->{excl} = $subTimes[$parents[-1]]->{excl} - $call->{duration};
$call->{id} = $entry;
$output .= qq|<a href="#" onclick="showhide('profile$call->{id}'); return(false);"> + </a>|;
} else {
$output .= ' | ';
} }
$output .= "<b>" if($call->{duration} > .3); if($subTimes[$entry + 1] && ($subTimes[$entry + 1]->{depth} > $call->{depth})) {
$output .= $call->{routine} . " (".sprintf("%.5f",$call->{duration})."s)"; # Do stuff to the next line if it's at a deeper depth.
$output .= "</b>" if($call->{duration} > .3); push(@parents,$entry);
}
my $nextDepth;
if(ref($subTimes[$entry +1])) {
$nextDepth = $subTimes[$entry + 1]->{depth};
} else {
$nextDepth = 1;
}
if($nextDepth < $call->{depth}) {
$nextDepth++;
for(1 .. ($call->{depth} - $nextDepth + 1)) {
pop @parents;
}
}
}
for(my $entry=0;$entry <= $#subTimes;$entry++) {
my $call = $subTimes[$entry];
$output .= "\n".'&nbsp;&nbsp;&nbsp;&nbsp;';
$output .= '&nbsp;&nbsp;|&nbsp;' for(2..$call->{depth});
if($subTimes[$entry + 1] && ($subTimes[$entry + 1]->{depth} > $call->{depth})) {
# Do stuff to the next line if it's at a deeper depth.
$output .= qq|<a href="#" onclick="showhide('profile$call->{entry}'); return(false);"> + </a>|;
} else {
$output .= ' &nbsp;| ';
}
$output .= "<b>" if($total < ($call->{duration} * 40));
$output .= $call->{routine} . " ( ".sprintf("%.4f",$call->{duration})."s )";
$output .= " &nbsp;". sprintf("%.2f",(($call->{duration} / $total)*100)).'%</b>' if($total < ($call->{duration} * 40));
$output .= "<b> Exclusive: ".sprintf("%.4f",$call->{excl})."s </b>" if ($call->{excl} ne $call->{duration});
$output .= "<br>\n"; $output .= "<br>\n";
my $nextDepth; my $nextDepth;
if(ref($subTimes[$entry +1])) { if(ref($subTimes[$entry +1])) {
@ -284,11 +311,13 @@ obj.style.display = "none";
} }
if($nextDepth < $call->{depth}) { if($nextDepth < $call->{depth}) {
$nextDepth++; $nextDepth++;
for($nextDepth .. $call->{depth}) { for(1 .. ($call->{depth} - $nextDepth + 1)) {
$output .= "\n</div>\n"; $output .= "\n</div>\n";
} }
} }
} }
$output .= "<br>\n<br>\n<br>\n<br>\n"; $output .= "<br>\n<br>\n<br>\n<br>\n";
undef(@subTimes); undef(@subTimes);
return $output; return $output;
@ -315,4 +344,5 @@ sub is_constant {
return $is_const; return $is_const;
} }
1; 1;