Bloat: Change coloring algorithm. Set the baseline every time there is a jump up or down.

This commit is contained in:
slamm%netscape.com 1999-11-02 20:09:20 +00:00
Родитель 6e901af5e4
Коммит 8c2b9af30f
2 изменённых файлов: 36 добавлений и 46 удалений

Просмотреть файл

@ -154,10 +154,10 @@ sub do_static {
}
sub do_tinderbox {
&tb_load_data;
my $tinderbox_data = &tb_load_data;
&print_page_head;
&print_table_header;
&print_table_body;
&print_table_body($tinderbox_data);
&print_table_footer;
}
@ -232,18 +232,17 @@ sub print_page_head {
}
sub print_table_body {
my $tinderbox_data = $_[0];
for (my $tt=0; $tt < $time_count; $tt++) {
last if $build_time_times->[$tt] < $mindate;
print_table_row($tt);
print_table_row($tinderbox_data, $tt);
}
}
sub print_bloat_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 ($value, $compare) = @_;
my $units = 'b';
if ($value >= 1000000) {
$value = int($value / 1000000);
$min = int($min / 1000000);
@ -254,10 +253,12 @@ sub print_bloat_delta {
$units = 'K';
}
if ($worse) {
return sprintf('<b><font color="#FF0000">%d%s</font></b>', $value, $units);
if ($compare > 0) {
return "<b><font color='red'>$value$units</font></b>";
} elsif ($compare < 0) {
return "<b><font color='blue'>$value$units</font></b>";
} else {
return sprintf('%d%s', $value, $units);
return "$value$units";
}
}
@ -266,7 +267,7 @@ BEGIN {
my $lasthour = '';
sub print_table_row {
my ($tt) = @_;
my ($td, $tt) = @_;
# Time column
#
@ -355,12 +356,11 @@ BEGIN {
# Leak/Bloat
#
if (defined $bloaty_by_log->{$logfile}) {
my ($leaks, $bloat);
($leaks, $bloat) = @{ $bloaty_by_log->{$logfile} };
printf "<br>Lk:%s<br>Bl:%s",
print_bloat_delta($leaks, $bloaty_min_leaks),
print_bloat_delta($bloat, $bloaty_min_bloat);
if (defined $td->{bloaty}{$logfile}) {
my ($leaks, $bloat, $leaks_cmp, $bloat_cmp)
= @{ $td->{bloaty}{$logfile} };
print "<br>Lk:", print_bloat_delta($leaks, $leaks_cmp),
"<br>Bl:", print_bloat_delta($bloat, $bloat_cmp);
}
# Binary

Просмотреть файл

@ -48,11 +48,6 @@ $build_table = [];
$who_list = [];
@note_array = ();
# Yeah, more globals.
$bloaty_by_log = {};
$bloaty_min_leaks = 0;
$bloaty_min_bloat = 0;
$gzip = '/usr/local/bin/gzip';
$data_dir='data';
@ -135,7 +130,7 @@ sub tb_load_data {
&make_build_table($td, $build_list);
($bloaty_min_leaks, $bloaty_min_bloat) = load_bloaty($td);
$td->{bloaty} = load_bloaty($td);
return $td;
}
@ -372,38 +367,33 @@ sub load_who {
#}
}
# Load data about code bloat
# File format: <build_time>|<build_name>|<leak_delta>|<bloat_delta>
#
sub load_bloaty {
my $treedata = $_[0];
local $_;
open(BLOATLOG, "<$treedata->{name}/bloat.dat");
my $leaks_list = [];
my $bloat_list = [];
my $index = 0;
my $list_max = 5; # only take the minimum over the last few entries
my $bloaty = {};
my ($bloat_baseline, $leaks_baseline) = (0,0);
open(BLOATLOG, "<$treedata->{name}/bloat.dat");
while (<BLOATLOG>) {
chomp;
my ($logfile, $leaks, $bloat) = split /\|/;
$bloaty_by_log->{$logfile} = [ $leaks, $bloat ];
$leaks_list[$index] = $leaks;
$bloat_list[$index] = $bloat;
$index++;
$index = 0 unless $index < $list_max;
# Allow 1k of noise
my $leaks_cmp = int(($leaks - $leaks_baseline) / 1000);
my $bloat_cmp = int(($bloat - $bloat_baseline) / 1000);
# If there was a rise or drop, set a new baseline
$leaks_baseline = $leaks unless $leaks_cmp == 0;
$bloat_baseline = $bloat unless $bloat_cmp == 0;
$bloaty->{$logfile} = [ $leaks, $bloat, $leaks_cmp, $bloat_cmp ];
}
my $leaks_min = $leaks_list[0];
my $bloat_min = $bloat_list[0];
for ($index = 1; $index < $list_max; $index++) {
if ($leaks_list[$index] < $leaks_min) {
$leaks_min = $leaks_list[$index];
}
if ($bloat_list[$index] < $bloat_min) {
$bloat_min = $bloat_list[$index];
}
}
return ($leaks_min, $bloat_min);
return $bloaty;
}
sub get_build_name_index {