"gestimate|gettingestimate",
"date",
"config|c:s",
- "file:s",
+ "file:s"
);
if($result !=1 ) {
&usage();
$opt_estimate = 1;
}
+$unit=`$sbindir/amgetconf$suf displayunit`;
+chomp($unit);
+$unitdivisor=1;
+if($unit eq 'K') {
+ $unitdivisor = 1;
+ $unit='k';
+}
+elsif($unit eq 'M') {
+ $unitdivisor = 1024;
+ $unit='m';
+}
+elsif($unit eq 'G') {
+ $unitdivisor = 1024*1024;
+ $unit='g';
+}
+elsif($unit eq 'T') {
+ $unitdivisor = 1024*1024*1024;
+ $unit='t';
+}
+
+
if( defined $opt_file) {
if( $opt_file =~ m,^/, ) {
$errfile = $opt_file;
while(<AMDUMP>) {
chomp;
if(/(amdump|amflush): start at (.*)/) {
- print " from $2";
+ print " from $2\n";
$starttime=&unctime(split(/[ ]+/,$2));
}
elsif(/amdump: datestamp (\S+)/) {
push @datestamp, $gdatestamp;
}
}
+ elsif(/setup_estimate: (\S+):(\S+): command .*, options: *(\S+) *last_level -?\d+ next_level0 -?\d+ level_days \d+ *getting estimates (-?\d) \(-2\) (-?\d) \(-2\) (-?\d) \(-2\)/) {
+ $host=$1;
+ $partition=$2;
+ $hostpart=&make_hostpart($host,$partition,$gdatestamp);
+ $estimate{$hostpart}=0;
+ $level{$hostpart}=0;
+ $esize{$hostpart}=0;
+ $dump_started{$hostpart}=0;
+ $dump_finished{$hostpart}=0;
+ $taper_started{$hostpart}=0;
+ $taper_finished{$hostpart}=0;
+ $partialestimate{$hostpart}=0;
+ $error{$hostpart}="";
+ if($4 != -1) { $getest{$hostpart} .= ":$4:" };
+ if($5 != -1) { $getest{$hostpart} .= ":$5:" };
+ if($6 != -1) { $getest{$hostpart} .= ":$6:" };
+ }
elsif(/setup_estimate: (\S+):(\S+): command .*, options:/) {
$host=$1;
$partition=$2;
$dump_finished{$hostpart}=0;
$taper_started{$hostpart}=0;
$taper_finished{$hostpart}=0;
+ $partialestimate{$hostpart}=0;
$error{$hostpart}="";
+ $_ = <AMDUMP>;
+ while (! /getting estimates/) { $_ = <AMDUMP>; }
+ chomp;
+ if(/getting estimates (-?\d) \(-2\) (-?\d) \(-2\) (-?\d) \(-2\)/) {
+ if($1 != -1) { $getest{$hostpart} .= ":$1:" };
+ if($2 != -1) { $getest{$hostpart} .= ":$2:" };
+ if($3 != -1) { $getest{$hostpart} .= ":$3:" };
+ }
+ else {
+ die("ERROR $_");
+ }
}
elsif(/got result for host (\S+) disk (\S+): (\d+) -> (\d+)K,/) {
$host=$1;
$hostpart=&make_hostpart($host,$partition,$gdatestamp);
$estimate{$hostpart}=1;
$level{$hostpart}=$3;
- $esize{$hostpart}=$4;
+ $esize{$hostpart}=$4 / $unitdivisor;
+ $partialestimate{$hostpart}=0;
+ $getest{$hostpart} = "";
+ }
+ elsif(/got partial result for host (\S+) disk (\S+): (-?\d+) -> (-?\d+)K, (-?\d+) -> (-?\d+)K, (-?\d+) -> (-?\d+)K/) {
+ $host=$1;
+ $partition=$2;
+ $hostpart=&make_hostpart($host,$partition,$gdatestamp);
+ if($4 > 0 || $6 > 0 || $8 > 0) {
+ $estimate{$hostpart}=1;
+ $level{$hostpart}=$3;
+ $esize{$hostpart}=$4 / $unitdivisor;
+ $partialestimate{$hostpart}=1;
+ if($4 > 0) { $getest{$hostpart} =~ s/:$3://; }
+ if($6 > 0) { $getest{$hostpart} =~ s/:$5://; }
+ if($8 > 0) { $getest{$hostpart} =~ s/:$7://; }
+
+ if($getest{$hostpart} eq "") { $partialestimate{$hostpart}=0; }
+ }
}
elsif(/getting estimates took/) {
$estimate_done=1;
$level{"$hostpart"}=$4;
$esize=$5;
$esize=32 if $esize<32;
- $esize{$hostpart}=$esize;
+ $esize{$hostpart}=$esize / $unitdivisor;
$degr_level{$hostpart}=-1;
}
}
$level{"$hostpart"}=$5;
$esize=$6;
$esize=32 if $esize<32;
- $esize{$hostpart}=$esize;
+ $esize{$hostpart}=$esize / $unitdivisor;
$degr_level{$hostpart}=-1;
}
}
$level{"$hostpart"}=$6;
$esize=$7;
$esize=32 if $esize<32;
- $esize{$hostpart}=$esize;
+ $esize{$hostpart}=$esize / $unitdivisor;
$degr_level{$hostpart}=-1;
}
}
$level{$hostpart}=$4;
$esize=$5;
$esize=32 if $esize<32;
- $esize{$hostpart}=$esize;
+ $esize{$hostpart}=$esize / $unitdivisor;
$degr_level{$hostpart}=$6;
- $degr_size{$hostpart}=$7;
+ $degr_size{$hostpart}=$7 / $unitdivisor;
$degr_size{$hostpart}=32 if ($7 < 32);
}
}
$level{$hostpart}=$5;
$esize=$6;
$esize=32 if $esize<32;
- $esize{$hostpart}=$esize;
+ $esize{$hostpart}=$esize / $unitdivisor;
$degr_level{$hostpart}=$7;
- $degr_size{$hostpart}=$8;
+ $degr_size{$hostpart}=$8 / $unitdivisor;
$degr_size{$hostpart}=32 if ($8 < 32);
}
}
elsif(/^FLUSH (\S+) (\S+) (\S+) (\d+) (\S+)/) {
$host=$1;
$partition=$2;
- $datestamp=$3;
+ $datestamp="$3";
$level=$4;
$holding_file=$5;
$hostpart=&make_hostpart($host,$partition,$datestamp);
$dumpers_active=0;
}
elsif(/^driver: tape size (\d+)/) {
- $tape_size = $1;
+ $tape_size = $1 / $unitdivisor;
}
elsif(/^driver: adding holding disk \d+ dir \S+ size (\d+)/) {
$holding_space += $1;
$dumpers_held[$dumpers_active]={};
}
}
+ elsif(/driver: send-cmd time (\S+) to (dumper\d*): CONTINUE (\d+-\d+) (\S+) (\d+) (\d+)/) {
+ $current_time=$1;
+ $serial=$3;
+ $hostpart=$serial{$serial};
+ if($hostpart ne "") {
+ $dump_roomq{$hostpart}=undef;
+ $error{$hostpart}="";
+ }
+ }
elsif(/driver: result time (\S+) from (dumper\d+): FAILED (\d+-\d+) (.*)/) {
$current_time=$1;
$serial=$3;
elsif(/driver: result time (\S+) from (dumper\d+): DONE (\d+-\d+) (\d+) (\d+) (\d+) \[.*\]/) {
$current_time=$1;
$serial=$3;
- $origsize=$4;
- $outputsize=$5;
+ $origsize=$4 / $unitdivisor;
+ $outputsize=$5 / $unitdivisor;
$hostpart=$serial{$serial};
$size{$hostpart}=$outputsize;
$dump_finished{$hostpart}=1;
$error{$hostpart}="driver: (aborted)";
$dumpers_active--;
}
+ elsif(/driver: result time (\S+) from (dumper\d+): RQ-MORE-DISK (\d+-\d+)/) {
+ $current_time=$1;
+ $serial=$3;
+ $hostpart=$serial{$serial};
+ $dump_roomq{$hostpart}=1;
+ $error{$hostpart}="(waiting for holding disk space)";
+ }
elsif(/driver: finished-cmd time (\S+) dumper\d+ dumped (\S+):(\S+)/){
$current_time=$1;
}
$current_time=$1;
$serial=$2;
$label=$3;
- $size=$6;
+ $size=$6 / $unitdivisor;
$hostpart=$serial{$serial};
$taper_finished{$hostpart}=1;
$busy_time{"taper"}+=($1-$taper_time{$hostpart});
$taper_time{$hostpart}=$1;
$error{$hostpart}="driver: $error";
}
- elsif(/planner: FAILED (\S+) (\S+) (\S+) (\d+) (.*)/) {
+ elsif(/driver: dump failed (\S+) (\S+) (\S+), too many dumper retry/) {
+ $serial=$1;
+ $hostpart=$serial{$serial};
+ $dump_started{$hostpart}=-1;
+ $dump_finished{$hostpart}=-2;
+ $error{$hostpart} .= "(too many dumper retry)";
+ }
+ elsif(/driver: tape failed (\S+) (\S+) (\S+), too many taper retry/) {
+ $serial=$1;
+ $hostpart=$serial{$serial};
+ $taper_started{$hostpart}=-1;
+ $taper_finished{$hostpart}=-2;
+ $error{$hostpart} .= "(too many taper retry)";
+ }
+ elsif(/planner: FAILED (\S+) (\S+) (\S+) (-?\d+) (.*)/) {
$host=$1;
$partition=$2;
$datestamp=$3;
$ntsize{$nb_tape} = 0;
$ntesize{$nb_tape} = 0;
}
+ else {
+ #print "Ignoring: $_\n";
+ }
}
close(AMDUMP);
}
}
-print "\n\n";
+print "\n";
$nb_partition = 0;
next if(!defined $estimate{$hostpart} && !defined $flush{$hostpart});
$nb_partition++;
if( !defined $size{$hostpart} && defined $holding_file{$hostpart}) {
- $size{$hostpart} = &dump_size($holding_file{$hostpart}) / 1024;
+ $size{$hostpart} = &dump_size($holding_file{$hostpart}) / (1024 * $unitdivisor);
}
$in_flush=0;
- if($estimate_done != 1) {
+ if($estimate_done != 1 && !defined $flush{$hostpart}) {
if(defined $estimate{$hostpart}) {
if($estimate{$hostpart} != 1) {
if( defined $opt_gestimate) {
}
}
else {
- if(defined $opt_estimate) {
+ if(defined $opt_estimate ||
+ (defined $opt_gestimate && $partialestimate{$hostpart} == 1)) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s", "$host:$partition";
printf "%2d", $level{$hostpart};
- printf "%9dk", $esize{$hostpart};
+ printf "%9d$unit", $esize{$hostpart};
+ if($partialestimate{$hostpart} == 1) {
+ print " partial";
+ }
print " estimate done\n";
}
$epartition++;
if( defined $opt_dumpingtape ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $esize{$hostpart};
+ printf "%9d$unit", $esize{$hostpart};
print " dumping to tape";
if( defined $starttime ) {
print " (", &showtime($taper_time{$hostpart}), ")";
if( defined $opt_writingtape ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $size{$hostpart};
+ printf "%9d$unit", $size{$hostpart};
if($in_flush == 0) {
print " writing to tape";
}
}
}
elsif($taper_finished{$hostpart} < 0) {
+
+ if(defined $size{$hostpart}) {
+ $xsize = $size{$hostpart};
+ }
+ elsif(defined $esize{$hostpart}) {
+ $xsize = $esize{$hostpart};
+ }
+ else {
+ $xsize = 0;
+ }
+
+ if(defined $esize{$hostpart}) {
+ $exsize += $esize{$hostpart};
+ }
+ else {
+ $exsize += $xsize;
+ }
+
if( defined $opt_failed ||
(defined $opt_waittaper && ($taper_finished{$hostpart} == -1))) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $size{$hostpart};
+ printf "%9d$unit", $xsize;
if($in_flush == 0) {
print " failed to tape";
}
}
$tfpartition++;
- $tfsize += $size{$hostpart};
- if(defined $esize{$hostpart}) {
- $tfesize += $esize{$hostpart};
- }
- else {
- $tfesize += $size{$hostpart};
- }
+ $tfsize += $xsize;
+ $tfesize += $exsize;
if($in_flush == 0) {
$twpartition++;
- $twsize += $size{$hostpart};
- if(defined $esize{$hostpart}) {
- $twesize += $esize{$hostpart};
- }
- else {
- $twesize += $size{$hostpart};
- }
+ $twsize += $xsize;
+ $twesize += $exsize;
}
else {
$wfpartition++;
- $wfsize += $size{$hostpart};
- if(defined $esize{$hostpart}) {
- $wfesize += $esize{$hostpart};
- }
- else {
- $wfesize += $size{$hostpart};
- }
+ $wfsize += $xsize;
}
}
elsif($taper_finished{$hostpart} == 1) {
if( defined $opt_finished ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $size{$hostpart};
+ printf "%9d$unit", $size{$hostpart};
if($in_flush == 0) {
print " finished";
}
if( defined $opt_waitdumping ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $esize{$hostpart};
+ printf "%9d$unit", $esize{$hostpart};
print " wait for dumping $error{$hostpart}\n";
}
$wpartition++;
if( defined $opt_dumping ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $esize{$hostpart};
- printf " dumping %8dk", $size{$hostpart};
+ printf "%9d$unit", $esize{$hostpart};
+ printf " dumping %8d$unit", $size{$hostpart};
if($size{$hostpart} != 0) {
printf " (%6.2f%%)", (100.0*$size{$hostpart})/$esize{$hostpart};
}
if( defined $starttime ) {
print " (", &showtime($dump_time{$hostpart}), ")";
}
+ if(defined $dump_roomq{$hostpart}) {
+ print " " . $error{$hostpart};
+ }
print "\n";
}
$dupartition++;
if( defined $opt_waittaper ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $size{$hostpart};
+ printf "%9d$unit", $size{$hostpart};
print " dump done";
if( defined $starttime ) {
print " (", &showtime($dump_time{$hostpart}), ")";
if( defined $opt_waittaper ) {
printf "%8s ", $datestamp if defined $opt_date;
printf "%-${maxnamelength}s%2d", "$host:$partition", $level{$hostpart};
- printf "%9dk", $size{$hostpart};
+ printf "%9d$unit", $size{$hostpart};
print " waiting to flush\n";
}
$wfpartition++;
print "SUMMARY part real estimated\n";
print " size size\n";
printf "partition : %3d\n", $nb_partition;
- printf "estimated : %3d %20dk\n", $epartition , $estsize;
- printf "flush : %3d %9dk\n", $flpartition, $flsize;
- printf "failed : %3d %20dk (%6.2f%%)\n",
+ printf "estimated : %3d %20d$unit\n", $epartition , $estsize;
+ printf "flush : %3d %9d$unit\n", $flpartition, $flsize;
+ printf "failed : %3d %20d$unit (%6.2f%%)\n",
$fpartition , $fsize,
$estsize ? ($fsize * 1.0 / $estsize) * 100 : 0.0;
- printf "wait for dumping: %3d %20dk (%6.2f%%)\n",
+ printf "wait for dumping: %3d %20d$unit (%6.2f%%)\n",
$wpartition , $wsize,
$estsize ? ($wsize * 1.0 / $estsize) * 100 : 0.0;
- printf "dumping to tape : %3d %20dk (%6.2f%%)\n",
+ printf "dumping to tape : %3d %20d$unit (%6.2f%%)\n",
$dtpartition, $dtesize,
$estsize ? ($dtesize * 1.0 / $estsize) * 100 : 0.0;
- printf "dumping : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "dumping : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$dupartition, $dusize, $duesize,
$duesize ? ($dusize * 1.0 / $duesize) * 100 : 0.0,
$estsize ? ($dusize * 1.0 / $estsize) * 100 : 0.0;
- printf "dumped : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "dumped : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$dpartition , $dsize , $desize,
$desize ? ($dsize * 1.0 / $desize) * 100 : 0.0,
$estsize ? ($dsize * 1.0 / $estsize) * 100 : 0.0;
- printf "wait for writing: %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "wait for writing: %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$twpartition, $twsize, $twesize,
$twesize ? ($twsize * 1.0 / $twesize) * 100 : 0.0,
$estsize ? ($twsize * 1.0 / $estsize) * 100 : 0.0;
- printf "wait to flush : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "wait to flush : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$wfpartition, $wfsize, $wfsize, 100, 0;
- printf "writing to tape : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "writing to tape : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$tapartition, $tasize, $taesize,
$taesize ? ($tasize * 1.0 / $taesize) * 100 : 0.0,
$estsize ? ($tasize * 1.0 / $estsize) * 100 : 0.0;
- printf "failed to tape : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "failed to tape : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$tfpartition, $tfsize, $tfesize,
$tfesize ? ($tfsize * 1.0 / $tfesize) * 100 : 0.0,
$estsize ? ($tfsize * 1.0 / $estsize) * 100 : 0.0;
- printf "taped : %3d %9dk %9dk (%6.2f%%) (%6.2f%%)\n",
+ printf "taped : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
$tpartition , $tsize , $tesize,
$tesize ? ($tsize * 1.0 / $tesize) * 100 : 0.0,
($estsize+$flsize) ? ($tsize * 1.0 / ($estsize + $flsize)) * 100 : 0.0;
if($nb_tape > 1 || $tape_size != 0) {
for($i=1; $i <= $nb_tape; $i++) {
if($tape_size != 0) {
- printf " tape %-3d : %3d %9dk %9dk (%6.2f%%) %s\n",
+ printf " tape %-3d : %3d %9d$unit %9d$unit (%6.2f%%) %s\n",
$i, $ntpartition{$i}, $ntsize{$i}, $ntesize{$i}, 100*$ntsize{$i}/$tape_size, $ntlabel{$i};
}
else {
- printf " tape %-3d : %3d %9dk %9dk %s\n",
+ printf " tape %-3d : %3d %9d$unit %9d$unit %s\n",
$i, $ntpartition{$i}, $ntsize{$i}, $ntesize{$i}, $ntlabel{$i};
}
}
} else {
$hs = 0.0;
}
- printf "holding space : %9dk (%6.2f%%)\n", $free{"space:"}, $hs;
+ printf "holding space : %9d$unit (%6.2f%%)\n", ($free{"space:"}/$unitdivisor), $hs;
}
}