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 #!/usr/bin/perl
while(<>) { while(<>) {
if(/^(\d+) (\d+) (\d+) \d+ \d+ \d+ \d+ \d+ \d+ (\d+) \d+ \d+ (\d+) (\d+) (\d+) (\d+) (\d+) /) { 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+)/) {
$node{$2}{$1} = $_; $t = $1 - $10 / 4096;
$lpm{$2} = $5;
$cpu{$2} = $6; $node{$2}{$t} = $_;
$rx{$2} = $7; $lpm{$2}{$t} = $5;
$tx{$2} = $8; $cpu{$2}{$t} = $6;
$rled{$2} = $9; $rx{$2}{$t} = $7;
$lasttime{$2} = $1; $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) { if($lastparent{$2} != $4) {
$parent{$2}{$1} = $4; $parent{$2}{$t} = $4;
} }
$lastparent{$2} = $4; $lastparent{$2} = $4;
if($lastseqno{$2} == $3) { 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} && if(defined $lastseqno{$2} &&
$3 != ($lastseqno{$2} + 1 % 256)) { $3 != ($lastseqno{$2} + 1 % 256)) {
$lost{$2}{$1} = 1; $lost{$2}{$t} = 1;
} }
$lastseqno{$2} = $3; $lastseqno{$2} = $3;
if($firsttime{$2} == 0) { if($firsttime{$2} == 0) {
$firsttime{$2} = $1; $firsttime{$2} = $t;
} }
} }
} }
@ -60,9 +82,14 @@ foreach $n (sort {$a <=> $b} keys %node) {
} }
} }
close(F); close(F);
open(F, ">> power"); open(F, "> power-data-$n");
print F ($lasttime{$n} - $firsttime{$n}) . " $n $lpm{$n} $cpu{$n} $rx{$n} $tx{$n} $rled{$n}\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); 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";
} }