1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-18 19:06:27 +02:00

m1/perf/favg: tool to extract values from ./tabulate -h and to calculate averages

This commit is contained in:
Werner Almesberger 2011-09-24 20:34:09 -03:00
parent 3da0074896
commit 71cdeb80df

19
m1/perf/favg Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/perl
$sel = $ARGV[0];
shift @ARGV;
for (@ARGV) {
$s = 0;
$n = 0;
open(FILE, $_) || die "$_: $!";
while (<FILE>) {
$c = 0 if /<TR>/;
if (/<TD[^>]*>([0-9.]+)/ ) {
$c++;
next unless $c == $sel;
$s += $1;
$n++;
}
}
close FILE;
print "$s/$n = ", $s/$n, "\n";
}