summaryrefslogtreecommitdiff
path: root/ghc/utils/parallel/ghc-fool-sort.pl
blob: dfa65a18755cf25f9a57d3fdfacb8d589d7185d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##############################################################################
#
# Usage: fool-sort 
#
# Takes a pure (i.e. no header lines) quasi-parallel profile (a .qp file) from
# stdin and inserts a counter as second field to force sort not to change the 
# ordering of lines with the same time stamp. The result is written to stdout.
#
##############################################################################

$last_time = 0;
while (<STDIN>) {
    ($time, @rest) = split;
    if ( $time == $last_time ) {
	$x = ++$count;
    } else {
	$x = $count = 0;
    }
    print $time, " ", $x, " ", join(' ',@rest), "\n";
    $last_time = $time;
}

exit 0;