48 lines
1.1 KiB
Perl
Executable File
48 lines
1.1 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
while(<>) {
|
|
|
|
if(/([IO]) (\d+) (\d+) (\d+) (\d+) (\d+).(\d+) (\d+) (\d+)/) {
|
|
$type = $1;
|
|
$node = $2;
|
|
$seq = $3;
|
|
$channel = $4;
|
|
$packettype = $5;
|
|
$esender1 = $6;
|
|
$esender2 = $7;
|
|
$tx = $8;
|
|
$rx = $9;
|
|
|
|
if($type cmp "I") {
|
|
$channel .= "-tx";
|
|
} else {
|
|
$channel .= "-rx";
|
|
}
|
|
|
|
if($packettype == 1) {
|
|
$channel .= "-ack"
|
|
}
|
|
|
|
$num_packets_for_channel{$channel}++;
|
|
$tx_for_channel{$channel} += $tx;
|
|
$rx_for_channel{$channel} += $rx;
|
|
$total += $rx + $tx;
|
|
|
|
if($forwarding) {
|
|
$forward += $tx + $rx;
|
|
} else {
|
|
$final += $tx + $rx;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
print "# Columns are:\n";
|
|
print "# activity tx_dutycycle rx_dutycycle num_packets\n";
|
|
|
|
foreach $c (keys %tx_for_channel) {
|
|
print "$c " . $tx_for_channel{$c}/$total . " " . $rx_for_channel{$c}/$total . " " . $num_packets_for_channel{$c} . "\n";
|
|
}
|
|
|
|
print STDERR "Final / forward = " . $final / $total . "/" . $forward / $total . "\n";
|