X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcount_bytes;fp=compiler%2Fcount_bytes;h=bf6240228fed95fb77ab5510adea4e8167a1c9d8;hp=0000000000000000000000000000000000000000;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hpb=28a464a75e14cece5db40f2765a29348273ff2d2 diff --git a/compiler/count_bytes b/compiler/count_bytes new file mode 100644 index 0000000..bf62402 --- /dev/null +++ b/compiler/count_bytes @@ -0,0 +1,43 @@ +#! /usr/local/bin/perl +# +%DirCount = (); +%ModCount = (); + +foreach $f ( @ARGV ) { + die "Not an .lhs file: $f\n" if $f !~ /\.lhs$/; + $f =~ s/\.lhs$/.o/; + + $f_size = `size $f`; + die "Size failed?\n" if $? != 0; + + if ( $f_size =~ /(\S+)\s*(\S+)\s*(\S+)\s*(\d+)\s*(\S+)/ ) { + $totsz = $4; + + if ( $f =~ /(.*)\/(.*)/ ) { + local($dir) = $1; + local($mod) = $2; + $DirCount{$dir} += $totsz; + $ModCount{$mod} += $totsz; + } else { + print STDERR "not counted in a directory: $f\n"; + $ModCount{$f} += $totsz; + } + } else { + die "Can't figure out size: $f_size\n"; + } +} + +# print the info +$tot = 0; +foreach $d (sort (keys %DirCount)) { + printf "%-20s %6d\n", $d, $DirCount{$d}; + $tot += $DirCount{$d}; +} +printf "\n%-20s %6d\n\n\n", 'TOTAL:', $tot; + +$tot = 0; +foreach $m (sort (keys %ModCount)) { + printf "%-20s %6d\n", $m, $ModCount{$m}; + $tot += $ModCount{$m}; +} +printf "\n%-20s %6d\n", 'TOTAL:', $tot;