Changeset 32961
- Timestamp:
- Dec 14, 2011, 4:11:56 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/tools/diskspace/merge_counts_and_sizes.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diskspace/merge_counts_and_sizes.pl
r32622 r32961 5 5 use PS::IPP::Config; 6 6 7 getopts('ND: ',\%opt);7 getopts('ND:M:',\%opt); 8 8 9 9 my $ipprc = PS::IPP::Config->new("GPC1"); … … 33 33 34 34 $size{$stage}{$product} = $size_in_gb; 35 $stage_min{$stage} += $size_in_gb; 35 36 $diskcount{$stage}{$product} = $count; 36 37 $total += $size_in_gb; … … 58 59 my $mappings_file = "neb:///ipp_diskspace/mappings_im.dat"; 59 60 my $M_real_file = $ipprc->file_resolve($mappings_file); 61 if (exists($opt{M})) { 62 $M_real_file = $opt{M}; 63 } 60 64 open(M,$M_real_file) || die "Cannot find mappings.dat\n"; 61 65 while (<M>) { 62 66 chomp; 63 67 unless ($_ =~ /^#/) { 64 ($stage,$product,$state) = split /\s+/; 65 $map{$stage}{$product}{$state} = 1; 66 if ($stage eq 'RAW' && $product eq 'FITS') { 67 if (($state eq 'full')||($state eq 'pending_burntool')||($state eq 'keep')||($state eq 'compressed')||($state eq 'error_compressed')|| 68 ($state eq 'goto_lossy')||($state eq 'check_burntool')) { 69 $map{$stage}{$product}{$state} = 2; 68 ($stage,$product,$state,$mult) = split /\s+/; 69 if (defined($mult)&&($mult !~ /^$/)) { 70 $map{$stage}{$product}{$state} = $mult; 71 } 72 else { 73 $map{$stage}{$product}{$state} = 1; 74 if ($stage eq 'RAW' && $product eq 'FITS') { 75 if (($state eq 'full')||($state eq 'pending_burntool')||($state eq 'keep')||($state eq 'compressed')||($state eq 'error_compressed')|| 76 ($state eq 'goto_lossy')||($state eq 'check_burntool')) { 77 $map{$stage}{$product}{$state} = 2; 78 } 70 79 } 71 80 } … … 88 97 $VpN{$stage}{$state} = 0; 89 98 foreach $product (keys (%{ $size{$stage} })) { 90 $N{$stage}{$product} += $ map{$stage}{$product}{$state} * $count{$stage}{$state};99 $N{$stage}{$product} += $count{$stage}{$state}; # $map{$stage}{$product}{$state} * $count{$stage}{$state}; 91 100 } 92 101 } … … 94 103 foreach $state (keys (%{ $count{$stage} })) { 95 104 if ($N{$stage}{$product} > 0) { 96 $VpN{$stage}{$state} += $ map{$stage}{$product}{$state} * $size{$stage}{$product} / $N{$stage}{$product};105 $VpN{$stage}{$state} += $size{$stage}{$product} / $N{$stage}{$product};#$map{$stage}{$product}{$state} * $size{$stage}{$product} / $N{$stage}{$product}; 97 106 $DVpN{$stage}{$state} += $map{$stage}{$product}{$state} * $size{$stage}{$product} / $diskcount{$stage}{$product}; 98 107 } … … 127 136 128 137 foreach $stage (sort (keys %VpN)) { 138 $measuredA = 0; 139 $measuredB = 0; 129 140 foreach $state (sort (keys %{ $VpN{$stage} })) { 130 141 unless(exists($count{$stage}{$state})) { … … 161 172 $labels{$label} += $V; 162 173 $alt_labels{$label} += $DVpN{$stage}{$state} * $count{$stage}{$state}; 174 $measuredA += $V; 175 $measuredB += $DVpN{$stage}{$state} * $count{$stage}{$state}; 163 176 printf("%-8s %-18s %-10s\t%14.4f %12.6f\t%14.6f %12.6f\t%9d\n", 164 177 $stage,$state,$label,$V,$VpN{$stage}{$state},$DVpN{$stage}{$state} * $count{$stage}{$state},$DVpN{$stage}{$state},$count{$stage}{$state}); … … 167 180 $stage,$state,$label,$V,$VpN{$stage}{$state},$DVpN{$stage}{$state} * $count{$stage}{$state},$DVpN{$stage}{$state},$count{$stage}{$state}); 168 181 } 182 } 183 printf("%-8s %-18s %-10s\t%14.4f %-12s\t%14.6f\n", 184 $stage,"","MINIMUM",$stage_min{$stage},"",$stage_min{$stage}); 185 printf("%-8s %-18s %-10s\t%14.4f %-12s\t%14.6f\n", 186 $stage,"","MEASURED",$measuredA,"",$measuredB); 187 if (exists($opt{N})) { 188 printf($out_fh "%-8s %-18s %-10s\t%14.4f %-12s\t%14.6f\n", 189 $stage,"","MINIMUM",$stage_min{$stage},"",$stage_min{$stage}); 169 190 } 170 191 }
Note:
See TracChangeset
for help on using the changeset viewer.
