Changeset 32265 for trunk/tools/diskspace/merge_counts_and_sizes.pl
- Timestamp:
- Aug 31, 2011, 5:18:37 PM (15 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
r32230 r32265 2 2 3 3 use Getopt::Std; 4 use DateTime; 5 use PS::IPP::Config; 4 6 5 getopts(' I',\%opt);7 getopts('N',\%opt); 6 8 7 open(S,"summary.dat") || die "Cannot find summary.dat\n"; 9 my $ipprc = PS::IPP::Config->new("GPC1"); 10 my $nebcon = $ipprc->nebulous(); 11 12 my @lt = gmtime; 13 my $dt = DateTime->now; 14 $dt->subtract( days => $lt[6] ); 15 my $datestring = $dt->ymd; 16 17 my $summary_file = "neb:///ipp_diskspace/${datestring}/summary.dat"; 18 my $S_real_file = $ipprc->file_resolve($summary_file); 19 open(S,$S_real_file) || die "Cannot find summary.dat\n"; 8 20 9 21 while (<S>) { … … 19 31 close(S); 20 32 21 if (exists($opt{I})) { 22 open(C,"run_im_counts.dat") || die "Cannot find run_counts.dat\n"; 23 } 24 else { 25 open(C,"run_counts.dat") || die "Cannot find run_counts.dat\n"; 26 } 33 my $count_file = "neb:///ipp_diskspace/${datestring}/run_im_counts.dat"; 34 my $C_real_file = $ipprc->file_resolve($count_file); 35 open(C,$C_real_file) || die "Cannot find run_counts.dat\n"; 27 36 while(<C>) { 28 37 chomp; … … 37 46 close(C); 38 47 39 if (exists($opt{I})) { 40 open(M,"mappings_im.dat") || die "Cannot find mappings.dat\n"; 41 } 42 else { 43 open(M,"mappings.dat") || die "Cannot find mappings.dat\n"; 44 } 48 my $mappings_file = "neb:///ipp_diskspace/mappings_im.dat"; 49 my $M_real_file = $ipprc->file_resolve($mappings_file); 50 open(M,$M_real_file) || die "Cannot find mappings.dat\n"; 45 51 while (<M>) { 46 52 chomp; … … 57 63 } 58 64 close(M); 65 59 66 foreach $stage (keys (%size)) { 60 67 foreach $state (keys (%{ $count{$stage} })) { … … 68 75 69 76 foreach $stage (keys (%size)) { 70 # unless ($stage eq 'RAW') { next; }71 77 foreach $state (keys (%{ $count{$stage} })) { 72 78 $VpN{$stage}{$state} = 0; 73 79 foreach $product (keys (%{ $size{$stage} })) { 74 80 $N{$stage}{$product} += $map{$stage}{$product}{$state} * $count{$stage}{$state}; 75 # if ($N{$stage}{$product} > 0) {76 # $VpN{$stage}{$state} += $size{$stage}{$product} / $N{$stage}{$product};77 # }78 79 81 } 80 82 } … … 89 91 } 90 92 93 my $out_fh; 94 95 if (exists($opt{N})) { 96 my $dt = DateTime->now; 97 98 my @lt = gmtime; 99 my $dt_data = DateTime->now; 100 $dt->subtract( days => $lt[6]); 101 my $datestring = $dt->ymd; 102 my $ipprc = PS::IPP::Config->new("GPC1"); 103 my $nebcon = $ipprc->nebulous(); 104 105 my $outfile = "neb:///ipp_diskspace/${datestring}/usage_report.dat"; 106 107 if ($ipprc->file_exists($outfile)) { 108 my $U_file = $ipprc->file_resolve($outfile); 109 open($out_fh,">$U_file"); 110 } 111 else { 112 $out_fh = $ipprc->file_create_open($outfile); 113 } 114 } 115 91 116 foreach $stage (sort (keys %VpN)) { 92 # unless ($stage eq 'RAW') { next; }93 94 117 foreach $state (sort (keys %{ $VpN{$stage} })) { 95 118 unless(exists($count{$stage}{$state})) { … … 124 147 printf("%-8s %-18s %-10s %14.4f %12.6f %9d\n", 125 148 $stage,$state,$label,$V,$VpN{$stage}{$state},$count{$stage}{$state}); 149 if (exists($opt{N})) { 150 printf($out_fh "%-8s %-18s %-10s %14.4f %12.6f %9d\n", 151 $stage,$state,$label,$V,$VpN{$stage}{$state},$count{$stage}{$state}); 152 } 126 153 } 127 154 } … … 130 157 $sum += $labels{$l}; 131 158 print STDERR "\t$l \t$labels{$l}\n"; 159 if (exists($opt{N})) { 160 print $out_fh "\t$l \t$labels{$l}\n"; 161 } 132 162 } 133 163 print STDERR "\tTOTAL \t$sum\n"; 134 164 print STDERR "\tEXP_TOT \t$total\n"; 165 166 if (exists($opt{N})) { 167 print $out_fh "\tTOTAL \t$sum\n"; 168 print $out_fh "\tEXP_TOT \t$total\n"; 169 close($out_fh); 170 }
Note:
See TracChangeset
for help on using the changeset viewer.
