Tools for parsing and plotting a power trace from Contiki
This commit is contained in:
parent
0eae63b29a
commit
8f7e96b06f
5 changed files with 248 additions and 0 deletions
55
tools/powertrace/parse-node-power
Executable file
55
tools/powertrace/parse-node-power
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$max_seq = 0;
|
||||
|
||||
for($i = 0; $i < 1000; $i++) {
|
||||
$max_radio[$i] = 0;
|
||||
$min_radio[$i] = 10000;
|
||||
}
|
||||
|
||||
while(<>) {
|
||||
|
||||
if(/P (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)/) {
|
||||
$node = $1;
|
||||
$seq = $2;
|
||||
$cpu = $3;
|
||||
$lpm = $4;
|
||||
$tx = $5;
|
||||
$rx = $6;
|
||||
$idle_tx = $7;
|
||||
$idle_rx = $8;
|
||||
|
||||
$nodes{$node} = 1;
|
||||
|
||||
$radio_now = $tx + $rx;
|
||||
$idle_now = $idle_tx + $idle_rx;
|
||||
$cpu_now = $lpm + $cpu;
|
||||
$dutycycle = $radio_now / $cpu_now;
|
||||
|
||||
$dutycycle_for_node[$node][$seq] = $dutycycle;
|
||||
$idle_for_node[$node][$seq] = $idle_now / $cpu_now;
|
||||
|
||||
if($seq > $max_seq) {
|
||||
$max_seq = $seq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach $j (keys %nodes) {
|
||||
$avg = 0;
|
||||
for($i = 0; $i < $max_seq; $i++) {
|
||||
$avg += $dutycycle_for_node[$j][$i];
|
||||
}
|
||||
$idle_avg = 0;
|
||||
for($i = 0; $i < $max_seq; $i++) {
|
||||
$idle_avg += $idle_for_node[$j][$i];
|
||||
}
|
||||
print $avg / $max_seq . " " . $idle_avg / $max_seq . " $j\n";
|
||||
|
||||
$total_avg += $avg;
|
||||
$total_idle += $idle_avg;
|
||||
}
|
||||
print "\n";
|
||||
|
||||
print STDERR "Idle percentage " . $total_idle / $total_avg . "\n";
|
||||
#print STDERR "Mean duty cycle " . 100 * $mean / $num_mean . "\n";
|
Loading…
Add table
Add a link
Reference in a new issue