diff --git a/webtools/tinderbox/showbuilds.cgi b/webtools/tinderbox/showbuilds.cgi
index 910dc04b621..ed1c77b6066 100755
--- a/webtools/tinderbox/showbuilds.cgi
+++ b/webtools/tinderbox/showbuilds.cgi
@@ -29,7 +29,7 @@ $default_root = '/cvsroot';
# Show 12 hours by default
#
-$nowdate = time;
+$nowdate = time;
if (not defined($maxdate = $form{maxdate})) {
$maxdate = $nowdate;
}
@@ -57,16 +57,10 @@ else {
$tree = $form{tree};
-# $rel_path is the relative path to webtools/tinderbox used for links.
-# It changes to "../" if the page is generated statically, because then
-# it is placed in tinderbox/$tree.
-$rel_path = '';
-
if (exists $form{rebuildguilty} or exists $form{showall}) {
system ("./buildwho.pl -days 7 $tree > /dev/null");
undef $form{rebuildguilty};
}
-
&show_tree_selector, exit if $form{tree} eq '';
&do_quickparse, exit if $form{quickparse};
&do_express, exit if $form{express};
@@ -151,7 +145,7 @@ sub do_static {
}
sub do_tinderbox {
- &tb_load_data;
+ &load_data;
&print_page_head;
&print_table_header;
&print_table_body;
@@ -229,152 +223,163 @@ sub print_page_head {
}
sub print_table_body {
- for (my $tt=0; $tt < $time_count; $tt++) {
+ for (my $tt=1; $tt <= $time_count; $tt++) {
last if $build_time_times->[$tt] < $mindate;
print_table_row($tt);
}
}
-sub print_bloat_delta {
+sub print_delta {
my ($value, $min) = @_;
# this function rounds off, and prints bad (> min) values in red
my $worse = ($value - $min) > 1000; # heuristic -- allow 1k of noise
- my $units = 'b';
+ my $units = "b";
if ($value >= 1000000) {
- $value = int($value / 1000000);
- $min = int($min / 1000000);
- $units = 'M';
- } elsif ($value >= 1000) {
- $value = int($value / 1000);
- $min = int($min / 1000);
- $units = 'K';
+ $value = int($value / 1000000);
+ $min = int($min / 1000000);
+ $units = "M";
+ }
+ else {
+ if ($value >= 1000) {
+ $value = int($value / 1000);
+ $min = int($min / 1000);
+ $units = "K";
+ }
}
if ($worse) {
- return sprintf('%d%s', $value, $units);
- } else {
- return sprintf('%d%s', $value, $units);
+ return sprintf("%d%s",
+ $value, $units);
+ }
+ else {
+ return sprintf("%d%s", $value, $units);
}
}
-BEGIN {
- # Make $lasthour persistent private variable for print_table_row().
- my $lasthour = '';
+sub print_table_row {
+ my ($tt) = @_;
- sub print_table_row {
- my ($tt) = @_;
+ # Time column
+ #
+ my $query_link = '';
+ my $end_query = '';
+ my $pretty_time = &print_time($build_time_times->[$tt]);
- # Time column
- #
- my $query_link = '';
- my $end_query = '';
- my $pretty_time = &print_time($build_time_times->[$tt]);
-
- ($hour) = $pretty_time =~ /(\d\d):/;
+ ($hour) = $pretty_time =~ /(\d\d):/;
- if ($lasthour ne $hour or &has_who_list($tt)) {
- $query_link = &query_ref($td, $build_time_times->[$tt]);
- $end_query = '';
- }
- if ($lasthour eq $hour) {
- $pretty_time =~ s/^.* //;
- } else {
- $lasthour = $hour;
- }
-
- my $hour_color = '';
- $hour_color = ' bgcolor=#e7e7e7' if $build_time_times->[$tt] % 7200 <= 3600;
- print "
",
- "$query_link\n$pretty_time$end_query | \n";
-
- # Guilty
- #
- print '';
- for $who (sort keys %{$who_list->[$tt]} ){
- my $qr = &who_menu($td, $build_time_times->[$tt],
- $build_time_times->[$tt-1],$who);
- $who =~ s/%.*$//;
- print " $qr$who\n";
- }
- print ' | ';
-
- # Build Status
- #
- for (my $build_index=0; $build_index < $name_count; $build_index++) {
- if (not defined($br = $build_table->[$tt][$build_index])) {
- # No build data for this time
- print " | \n";
- next;
- }
- next if $br == -1; # rowspan has covered this row
-
- my $rowspan = $br->{rowspan};
- $rowspan = $mindate_time_count - $tt + 1
- if $tt + $rowspan - 1 > $mindate_time_count;
- print "{buildstatus}}>\n";
-
- my $logfile = $br->{logfile};
- my $buildtree = $br->{td}->{name};
-
- print "\n";
-
- # Build Note
- #
- my $logurl = "${rel_path}showlog.cgi?log=$buildtree/$logfile";
-
- if ($br->{hasnote}) {
- print "{noteid},'$logfile');\">",
- "\n";
- }
-
- # Build Log
- #
- print ""
- ."L";
-
- # What Changed
- #
- # Only add the "C" link if there have been changes since the last build.
- if( $br->{previousbuildtime} ){
- my $previous_br = $build_table->[$tt+$rowspan][$build_index];
- my $previous_rowspan = $previous_br->{rowspan};
- if (&has_who_list($tt+$rowspan,
- $tt+$rowspan+$previous_rowspan-1)) {
- print "\n", &query_ref($br->{td},
- $br->{previousbuildtime},
- $br->{buildtime});
- print "C";
- }
- }
-
- # Leak/Bloat
- #
- if (defined $bloaty_by_log->{$logfile}) {
- my ($leaks, $bloat);
- ($leaks, $bloat) = @{ $bloaty_by_log->{$logfile} };
- printf " Lk:%s Bl:%s",
- print_bloat_delta($leaks, $bloaty_min_leaks),
- print_bloat_delta($bloat, $bloaty_min_bloat);
- }
-
- # Binary
- #
- if ($br->{binaryname} ne '') {
- $binfile = "$buildtree/bin/$br->{buildtime}/$br->{buildname}/"
- ."$br->{binaryname}";
- $binfile =~ s/ //g;
- print " B";
- }
- print "\n | ";
- }
- print "
\n";
+ if ($lasthour != $hour or &has_who_list($tt)) {
+ $query_link = &query_ref($td1, $build_time_times->[$tt]);
+ $end_query = '';
}
+ if ($lasthour == $hour) {
+ $pretty_time =~ s/^.* //;
+ } else {
+ $lasthour = $hour;
+ }
+
+ my $hour_color = '';
+ $hour_color = ' bgcolor=#e7e7e7' if $build_time_times->[$tt] % 7200 <= 3600;
+ print "",
+ "$query_link\n$pretty_time$end_query | \n";
+
+ # Guilty
+ #
+ print '';
+ for $who (sort keys %{$who_list->[$tt]} ){
+ $qr = &who_menu($td1, $build_time_times->[$tt],
+ $build_time_times->[$tt-1],$who);
+ $who =~ s/%.*$//;
+ print " ${qr}$who\n";
+ }
+ print ' | ';
+
+ # Build Status
+ #
+ for ($bn=1; $bn <= $name_count; $bn++) {
+ if (not defined($br = $build_table->[$tt][$bn])) {
+ # No build data for this time
+ print " | \n";
+ next;
+ }
+ next if $br == -1; # rowspan has covered this row
+
+ $hasnote = $br->{hasnote};
+ $noteid = $hasnote ? $br->{noteid} : 0;
+ $rowspan = $br->{rowspan};
+ $rowspan = $mindate_time_count - $tt + 1
+ if $tt + $rowspan - 1 > $mindate_time_count;
+ $color = $colormap{$br->{buildstatus}};
+ $status = $br->{buildstatus};
+ print "\n";
+
+ $logfile = $br->{logfile};
+ $errorparser = $br->{errorparser};
+ $buildname = $br->{buildname};
+ $buildtime = $br->{buildtime};
+ $buildtree = $br->{td}->{name};
+
+ print "\n";
+
+ # Build Note
+ #
+ $buildname = &url_encode($buildname);
+ my $logurl = "${rel_path}showlog.cgi?log=$buildtree/$logfile";
+
+ if ($hasnote) {
+ print "",
+ "\n";
+ }
+
+ # Build Log
+ #
+ print "";
+ print "L";
+
+ # What Changed
+ #
+ if( $br->{previousbuildtime} ){
+ my $previous_br = $build_table->[$tt+$rowspan][$bn];
+ my $previous_rowspan = $previous_br->{rowspan};
+ if (&has_who_list($tt+$rowspan,
+ $tt+$rowspan+$previous_rowspan-1)) {
+ print "\n", &query_ref($br->{td},
+ $br->{previousbuildtime},
+ $br->{buildtime});
+ print "C";
+ }
+ }
+
+ # Leak/Bloat
+ #
+ if (defined $bloat_by_log->{$logfile}) {
+ my $leaks, $bloat;
+ ($leaks, $bloat) = @{ $bloat_by_log->{$logfile} };
+ # Percentage, or absolute?
+ # printf " %+.2f %+.2f", $leaks, $bloat;
+ #printf " %d %d", $leaks, $bloat;
+ printf " Lk:%s Bl:%s",
+ print_delta($leaks, $minLeaks),
+ print_delta($bloat, $minBloat);
+ }
+
+ # Binary
+ #
+ if ($br->{binaryname} ne '') {
+ $binfile = "$buildtree/bin/$buildtime/$br->{buildname}/"
+ ."$br->{binaryname}";
+ $binfile =~ s/ //g;
+ print " B";
+ }
+ print "\n | ";
+ }
+ print "
\n";
}
sub print_table_header {
+ my $ii, $nspan;
+
print "