r4757 - developers/werner/wlan-perf
werner at docs.openmoko.org
werner at docs.openmoko.org
Thu Nov 6 01:04:47 CET 2008
Author: werner
Date: 2008-11-06 01:04:46 +0100 (Thu, 06 Nov 2008)
New Revision: 4757
Added:
developers/werner/wlan-perf/pingh
Log:
Histogram maker that takes the guesswork out of choosing the bin size.
It's so simple - why haven't I thought of this years ago already ?
Added: developers/werner/wlan-perf/pingh
===================================================================
--- developers/werner/wlan-perf/pingh (rev 0)
+++ developers/werner/wlan-perf/pingh 2008-11-06 00:04:46 UTC (rev 4757)
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+#
+# Adaptative ping latency histogram maker: exponentially varies bin sizes to
+# show the structure of the data set.
+#
+
+use Fcntl ':mode';
+
+
+sub extract_ping()
+{
+ local ($name) = @_;
+ local (@time);
+
+ open(F, $name) || die "$name: $!";
+ while (<F>) {
+ if (/ time=(\S+) ms/) {
+ push(@time, $1);
+ }
+ }
+ close F;
+ return @time;
+}
+
+
+die "usage: $0 ping_file" unless defined $ARGV[0];
+
+ at t = &extract_ping($ARGV[0]);
+
+$max = 0;
+for (@t) {
+ $max = $_ if $max < $_;
+}
+
+$width = $ARGV[1];
+if (defined $width) {
+ for (@t) {
+ $bin[int($_/$width)]++;
+ }
+
+ for ($i = 0; $i != @bin; $i++) {
+ print $width*($i+0.5), " ", 0+$bin[$i], "\n";
+ }
+}
+else {
+ $mode = (stat(STDOUT))[2];
+ if (!S_ISFIFO($mode)) {
+ open(STDOUT, "|gnuplot -persist") || die "gnuplot: $!";
+ }
+
+ print "plot ";
+ for ($w = 1; $w < $max; $w *= 2) {
+ print ", " unless $w == 1;
+ print "\"< $0 $ARGV[0] $w\" with lines title \"$w\"";
+ }
+ print "\n";
+}
+
Property changes on: developers/werner/wlan-perf/pingh
___________________________________________________________________
Name: svn:executable
+ *
More information about the commitlog
mailing list