Make TcGenDeriv warning-free
[ghc-hetmet.git] / utils / parallel / ghc-fool-sort.pl
1 ##############################################################################
2 #
3 # Usage: fool-sort 
4 #
5 # Takes a pure (i.e. no header lines) quasi-parallel profile (a .qp file) from
6 # stdin and inserts a counter as second field to force sort not to change the 
7 # ordering of lines with the same time stamp. The result is written to stdout.
8 #
9 ##############################################################################
10
11 $last_time = 0;
12 while (<STDIN>) {
13     ($time, @rest) = split;
14     if ( $time == $last_time ) {
15         $x = ++$count;
16     } else {
17         $x = $count = 0;
18     }
19     print $time, " ", $x, " ", join(' ',@rest), "\n";
20     $last_time = $time;
21 }
22
23 exit 0;