IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32961


Ignore:
Timestamp:
Dec 14, 2011, 4:11:56 PM (14 years ago)
Author:
watersc1
Message:

Updated to use mapping multiplicities. Also supplies stage level summaries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diskspace/merge_counts_and_sizes.pl

    r32622 r32961  
    55use PS::IPP::Config;
    66
    7 getopts('ND:',\%opt);
     7getopts('ND:M:',\%opt);
    88
    99my $ipprc = PS::IPP::Config->new("GPC1");
     
    3333
    3434        $size{$stage}{$product} = $size_in_gb;
     35        $stage_min{$stage} += $size_in_gb;
    3536        $diskcount{$stage}{$product} = $count;
    3637        $total += $size_in_gb;
     
    5859my $mappings_file = "neb:///ipp_diskspace/mappings_im.dat";
    5960my $M_real_file = $ipprc->file_resolve($mappings_file);
     61if (exists($opt{M})) {
     62    $M_real_file = $opt{M};
     63}
    6064open(M,$M_real_file) || die "Cannot find mappings.dat\n";
    6165while (<M>) {
    6266    chomp;
    6367    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                }
    7079            }
    7180        }
     
    8897        $VpN{$stage}{$state} = 0;
    8998        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};
    91100        }               
    92101    }
     
    94103        foreach $state (keys (%{ $count{$stage} })) {
    95104            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};
    97106                $DVpN{$stage}{$state} += $map{$stage}{$product}{$state} * $size{$stage}{$product} / $diskcount{$stage}{$product};
    98107            }
     
    127136
    128137foreach $stage (sort (keys %VpN)) {
     138    $measuredA = 0;
     139    $measuredB = 0;
    129140    foreach $state (sort (keys %{ $VpN{$stage} })) {
    130141        unless(exists($count{$stage}{$state})) {
     
    161172        $labels{$label} += $V;
    162173        $alt_labels{$label} += $DVpN{$stage}{$state} * $count{$stage}{$state};
     174        $measuredA += $V;
     175        $measuredB += $DVpN{$stage}{$state} * $count{$stage}{$state};
    163176        printf("%-8s %-18s %-10s\t%14.4f %12.6f\t%14.6f %12.6f\t%9d\n",
    164177                $stage,$state,$label,$V,$VpN{$stage}{$state},$DVpN{$stage}{$state} * $count{$stage}{$state},$DVpN{$stage}{$state},$count{$stage}{$state});
     
    167180                   $stage,$state,$label,$V,$VpN{$stage}{$state},$DVpN{$stage}{$state} * $count{$stage}{$state},$DVpN{$stage}{$state},$count{$stage}{$state});
    168181        }
     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});
    169190    }
    170191}
Note: See TracChangeset for help on using the changeset viewer.