blob: d30c7777ce5bbff6b18da798621966d5802015ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#
# Convert several .gr files (from the same GUM run) into a single
# .gr file with all times adjusted relative to the earliest start
# time.
#
$count = 0;
foreach $i (@ARGV) {
open(GR, $i) || die "Can't read $i\n";
$cmd = <GR>;
$start = <GR>;
($pe, $timestamp) = ($start =~ /PE\s+(\d+) \[(\d+)\]/);
die "PE $pe too high\n" if $pe > $#ARGV;
$proc[$count++] = $pe;
$prog[$pe] = $cmd;
$time[$pe] = $timestamp;
close(GR) || die "Can't close $i\n";
}
$basetime = 0;
for($i = 0; $i < $count; $i++) {
$pe = $proc[$i];
die "PE $pe missing?\n" if !defined($time[$pe]);
die "Mismatched .gr files\n" if $pe > 0 && $prog[$pe] ne $prog[$pe - 1];
$basetime = $time[$pe] if $basetime == 0 || $basetime > $time[$pe];
}
print $cmd;
for($i = 0; $i < $count; $i++) {
$pe = $proc[$i];
$delta = $time[$pe] - $basetime;
open(GR, $ARGV[$i]) || die "Can't read $ARGV[i]\n";
$cmd = <GR>;
$start = <GR>;
while(<GR>) {
/PE\s+(\d+) \[(\d+)\]/;
printf "PE %2u [%lu]%s", $1, $2 + $delta, $';
}
close(GR) || die "Can't close $ARGV[$i]\n";
}
|