diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
commit | 0065d5ab628975892cea1ec7303f968c3338cbe1 (patch) | |
tree | 8e2afe0ab48ee33cf95009809d67c9649573ef92 /utils/parallel/gr2RTS.pl | |
parent | 28a464a75e14cece5db40f2765a29348273ff2d2 (diff) | |
download | haskell-0065d5ab628975892cea1ec7303f968c3338cbe1.tar.gz |
Reorganisation of the source tree
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
Diffstat (limited to 'utils/parallel/gr2RTS.pl')
-rw-r--r-- | utils/parallel/gr2RTS.pl | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/utils/parallel/gr2RTS.pl b/utils/parallel/gr2RTS.pl new file mode 100644 index 0000000000..c609334c28 --- /dev/null +++ b/utils/parallel/gr2RTS.pl @@ -0,0 +1,138 @@ +#!/usr/local/bin/perl +# (C) Hans Wolfgang Loidl, July 1995 +############################################################################## +# Time-stamp: <Thu Oct 26 1995 18:40:10 Stardate: [-31]6498.68 hwloidl> +# +# Usage: gr2RTS [options] <sim-file> +# +# Options: +# -o <file> ... write output to <file> +# -h ... help; print this text. +# -v ... verbose mode. +# +############################################################################## + +# ---------------------------------------------------------------------------- +# Command line processing and initialization +# ---------------------------------------------------------------------------- + +require "getopts.pl"; + +&Getopts('hvo:'); + +do process_options(); + +if ( $opt_v ) { + do print_verbose_message (); +} + +# ---------------------------------------------------------------------------- +# The real thing +# ---------------------------------------------------------------------------- + +open(INPUT,"<$input") || die "Couldn't open input file $input"; +open(OUTPUT,"| sort -n > $output") || die "Couldn't open output file $output"; + +#do skip_header(); + +$tot_total_rt = 0; +$tot_rt = 0; + +$line_no = 0; +while (<INPUT>) { + next if /^--/; # Comment lines start with -- + next if /^\s*$/; # Skip empty lines + $line_no++; + @fields = split(/[:,]/,$_); + $has_end = 0; + + foreach $elem (@fields) { + foo : { + $pe = $1, $end = $2 , last foo if $elem =~ /^\s*PE\s+(\d+)\s+\[(\d+)\].*$/; + $tn = $1, $has_end = 1 , last foo if $elem =~ /^\s*END\s+(\w+).*$/; + # $tn = $1 , last foo if $elem =~ /^\s*TN\s+(\w+).*$/; + $sn = $1 , last foo if $elem =~ /^\s*SN\s+(\d+).*$/; + $start = $1 , last foo if $elem =~ /^\s*ST\s+(\d+).*$/; + $is_global = $1 , last foo if $elem =~ /^\s*EXP\s+(T|F).*$/; + $bbs = $1 , last foo if $elem =~ /^\s*BB\s+(\d+).*$/; + $ha = $1 , last foo if $elem =~ /^\s*HA\s+(\d+).*$/; + $rt = $1 , last foo if $elem =~ /^\s*RT\s+(\d+).*$/; + $bt = $1, $bc = $2 , last foo if $elem =~ /^\s*BT\s+(\d+)\s+\((\d+)\).*$/; + $ft = $1, $fc = $2 , last foo if $elem =~ /^\s*FT\s+(\d+)\s+\((\d+)\).*$/; + $lsp = $1 , last foo if $elem =~ /^\s*LS\s+(\d+).*$/; + $gsp = $1 , last foo if $elem =~ /^\s*GS\s+(\d+).*$/; + $my = $1 , last foo if $elem =~ /^\s*MY\s+(T|F).*$/; + } + } + + next unless $has_end == 1; + + $total_rt = $end - $start; + $tot_total_rt += $total_rt; + $tot_rt += $rt; + + print OUTPUT "$rt\n"; + $sum_rt += $rt; + $max_rt = $rt if $rt > $max_rt; +} + +close INPUT; +close OUTPUT; + +# Hack to fake a filter +if ( $output eq $filter_output ) { + system "cat $output"; + system "rm $output"; +} + +exit 0; + +# --------------------------------------------------------------------------- + +sub process_options { + if ( $opt_h ) { + open(ME,$0) || die "Can't open myself ($0)"; + $n = 0; + while (<ME>) { + last if $_ =~ /^$/; + print $_; + $n++; + } + close(ME); + + # system "cat $0 | awk 'BEGIN { n = 0; } \ + # /^$/ { print n; \ + # exit; } \ + # { n++; }'" + exit ; + } + + $input = $#ARGV == -1 ? "-" : $ARGV[0] ; + + if ( $#ARGV != 0 ) { + #print "Usage: gran-extr [options] <sim-file>\n"; + #print "Use -h option to get details\n"; + #exit 1; + + } + + $filter_output = $ENV{'TMPDIR'} . "./,gr2RTS-out"; + if ( $opt_o ) { + $output = $opt_o; + } else { + if ( $input eq "-" ) { + $output = $filter_output; + } else { + $output = $input; # "RTS"; + $output =~ s/\.gr$/.rts/g; + } # + } +} + +# ---------------------------------------------------------------------------- + +sub print_verbose_message { + print "Input file: $input\t Output file: $output\n"; +} + +# ---------------------------------------------------------------------------- |