Adding bloat formatting, baseline mechanism. warren/mcafee

This commit is contained in:
mcafee%netscape.com 1999-10-28 23:18:50 +00:00
parent 76eb2695a4
commit f9e04a43da
2 changed files with 42 additions and 3 deletions

View File

@ -229,6 +229,32 @@ sub print_table_body {
}
}
sub print_delta {
my ($value, $min) = @_;
# this function rounds off, and prints bad (> min) values in red
my $units = "b";
if ($value >= 1000000) {
$value = int($value / 1000000);
$min = int($min / 1000000);
$units = "Mb";
}
else {
if ($value >= 1000) {
$value = int($value / 1000);
$min = int($min / 1000);
$units = "Kb";
}
}
if ($value > $min) {
return sprintf("<b><font color=\"#FF0000\">%d%s</font></b>",
$value, $units);
}
else {
return sprintf("%d%s", $value, $units);
}
}
sub print_table_row {
my ($tt) = @_;
@ -330,7 +356,10 @@ sub print_table_row {
($leaks, $bloat) = @{ $bloat_by_log->{$logfile} };
# Percentage, or absolute?
# printf "<br>%+.2f<br>%+.2f", $leaks, $bloat;
printf "<br>%d<br>%d", $leaks, $bloat;
#printf "<br>%d<br>%d", $leaks, $bloat;
printf "<br>Lk:%s<br>Bl:%s",
print_delta($leaks, $minLeaks),
print_delta($bloat, $minBloat);
}
# Binary

View File

@ -44,7 +44,8 @@ $who_list2 = [];
@note_array = ();
$bloat_by_log = {};
$minLeaks = 0;
$minBloat = 0;
#$body_tag = "<BODY TEXT=#000000 BGCOLOR=#8080C0 LINK=#FFFFFF VLINK=#800080 ALINK=#FFFF00>";
#$body_tag = "<BODY TEXT=#000000 BGCOLOR=#FFFFC0 LINK=#0000FF VLINK=#800080 ALINK=#FF00FF>";
@ -184,7 +185,7 @@ sub load_data {
&make_build_table;
load_bloat($td1);
($minLeaks, $minBloat) = load_bloat($td1);
}
sub load_buildlog {
@ -324,11 +325,20 @@ sub load_bloat {
my ($treedata) = @_;
local $_;
open(BLOATLOG, "<$treedata->{name}/bloat.dat");
my $leakMin = -1;
my $bloatMin = -1;
while (<BLOATLOG>) {
chomp;
my ($logfile, $leaks, $bloat) = split /\|/;
$bloat_by_log->{$logfile} = [ $leaks, $bloat ];
if ($leakMin == -1 || $leaks < $leakMin) {
$leakMin = $leaks;
}
if ($bloatMin == -1 || $bloats < $bloatMin) {
$bloatMin = $bloats;
}
}
return ($leakMin, $bloatMin);
}
sub get_build_name_index {