From 71cdeb80df5e426bf35c417123668b2b206ff3a5 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 24 Sep 2011 20:34:09 -0300 Subject: [PATCH] m1/perf/favg: tool to extract values from ./tabulate -h and to calculate averages --- m1/perf/favg | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 m1/perf/favg diff --git a/m1/perf/favg b/m1/perf/favg new file mode 100755 index 0000000..7495f15 --- /dev/null +++ b/m1/perf/favg @@ -0,0 +1,19 @@ +#!/usr/bin/perl +$sel = $ARGV[0]; +shift @ARGV; +for (@ARGV) { + $s = 0; + $n = 0; + open(FILE, $_) || die "$_: $!"; + while () { + $c = 0 if //; + if (/]*>([0-9.]+)/ ) { + $c++; + next unless $c == $sel; + $s += $1; + $n++; + } + } + close FILE; + print "$s/$n = ", $s/$n, "\n"; +}