Added extraction of power data (not just energy)

This commit is contained in:
adamdunkels 2008-01-08 08:07:23 +00:00
parent bfd894c7bd
commit ff42002bc5

View File

@ -1,30 +1,52 @@
#!/usr/bin/perl
while(<>) {
if(/^(\d+) (\d+) (\d+) \d+ \d+ \d+ \d+ \d+ \d+ (\d+) \d+ \d+ (\d+) (\d+) (\d+) (\d+) (\d+) /) {
$node{$2}{$1} = $_;
$lpm{$2} = $5;
$cpu{$2} = $6;
$rx{$2} = $7;
$tx{$2} = $8;
$rled{$2} = $9;
$lasttime{$2} = $1;
if(/^(\d+) (\d+) (\d+) \d+ \d+ \d+ \d+ \d+ \d+ (\d+) \d+ \d+ (\d+) (\d+) (\d+) (\d+) (\d+) \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ (\d+)/) {
$t = $1 - $10 / 4096;
$node{$2}{$t} = $_;
$lpm{$2}{$t} = $5;
$cpu{$2}{$t} = $6;
$rx{$2}{$t} = $7;
$tx{$2}{$t} = $8;
$rled{$2}{$t} = $9;
$totallpm{$2} = $5;
$totalcpu{$2} = $6;
$totalrx{$2} = $7;
$totaltx{$2} = $8;
$totalrled{$2} = $9;
$div = $t - $lasttime{$2};
if($lasttime{$2} > 0 && $div != 0 && $lastseqno{$2} != $3) {
$lpmpower{$2}{$t} = ($lpm{$2}{$t} - $lpm{$2}{$lasttime{$2}}) / $div;
$cpupower{$2}{$t} = ($cpu{$2}{$t} - $cpu{$2}{$lasttime{$2}}) / $div;
$rxpower{$2}{$t} = ($rx{$2}{$t} - $rx{$2}{$lasttime{$2}}) / $div;
$txpower{$2}{$t} = ($tx{$2}{$t} - $tx{$2}{$lasttime{$2}}) / $div;
$rledpower{$2}{$t} = ($rled{$2}{$t} - $rled{$2}{$lasttime{$2}}) / $div;
}
$lasttime{$2} = $t;
if($lastparent{$2} != $4) {
$parent{$2}{$1} = $4;
$parent{$2}{$t} = $4;
}
$lastparent{$2} = $4;
if($lastseqno{$2} == $3) {
$dup{$2}{$1} = 1;
$dup{$2}{$t} = 1;
}
if($lastseqno{$2} > $3 && $lastseqno{$2} > $3 + 256) {
print "Reordering at seqno $3 for node $2\n";
}
if(defined $lastseqno{$2} &&
$3 != ($lastseqno{$2} + 1 % 256)) {
$lost{$2}{$1} = 1;
$lost{$2}{$t} = 1;
}
$lastseqno{$2} = $3;
if($firsttime{$2} == 0) {
$firsttime{$2} = $1;
$firsttime{$2} = $t;
}
}
}
@ -60,9 +82,14 @@ foreach $n (sort {$a <=> $b} keys %node) {
}
}
close(F);
open(F, ">> power");
print F ($lasttime{$n} - $firsttime{$n}) . " $n $lpm{$n} $cpu{$n} $rx{$n} $tx{$n} $rled{$n}\n";
open(F, "> power-data-$n");
foreach $k (sort keys %{$lpmpower{$n}}) {
print F "$k $lpmpower{$n}{$k} $cpupower{$n}{$k} $rxpower{$n}{$k} $txpower{$n}{$k} $rledpower{$n}{$k}\n";
}
close(F);
# print "\n";
open(F, ">> total-power");
print F ($lasttime{$n} - $firsttime{$n}) . " $n $totallpm{$n} $totalcpu{$n} $totalrx{$n} $totaltx{$n} $totalrled{$n}\n";
close(F);
print "\n";
}