r4743 - in developers/werner: . wlan-perf
werner at docs.openmoko.org
werner at docs.openmoko.org
Sun Nov 2 22:42:03 CET 2008
Author: werner
Date: 2008-11-02 22:41:59 +0100 (Sun, 02 Nov 2008)
New Revision: 4743
Added:
developers/werner/wlan-perf/
developers/werner/wlan-perf/measure
developers/werner/wlan-perf/report
Log:
Tools to measure WLAN performance:
- measure: runs ttcp and ping between a Neo and a host (in both directions)
and records the results in files named _*
- report: pretty-prints the measurement data
Added: developers/werner/wlan-perf/measure
===================================================================
--- developers/werner/wlan-perf/measure (rev 0)
+++ developers/werner/wlan-perf/measure 2008-11-02 21:41:59 UTC (rev 4743)
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+N=10
+P=100
+
+
+host=192.168.1.2
+
+
+# ----- ttcp measurements -----------------------------------------------------
+
+
+ttcp_rx_one()
+{
+ neo ./ttcp -r -s 2>&1 | tee -a _rx_neo &
+ sleep 2
+ ttcp -t -s $neo 2>&1 | tee -a _rx_host
+ sleep 2
+}
+
+
+ttcp_tx_one()
+{
+ ttcp -r -s 2>&1 | tee -a _tx_host &
+ sleep 1
+ neo ./ttcp -t -s $host 2>&1 | tee -a _tx_neo
+ sleep 2
+}
+
+
+ttcp_loop()
+{
+ i=0
+ while [ $i -lt $N ]; do
+ i=`expr $i + 1`
+ echo ===== $i: "$@" =====
+ $@
+ done
+}
+
+
+ttcp_rx()
+{
+ ttcp_loop ttcp_rx_one
+}
+
+
+ttcp_tx()
+{
+ ttcp_loop ttcp_tx_one
+}
+
+
+# ----- ping measurements -----------------------------------------------------
+
+
+ping_rx()
+{
+ ping -c $P $neo | tee _ping_rx
+}
+
+
+ping_tx()
+{
+ neo ping -c $P $host | tee _ping_tx
+}
+
+
+# ----- setup -----------------------------------------------------------------
+
+
+neo=`neo ip address show dev eth0 | sed 's|.*inet \([^ ]*\)/.*|\1|p;d'`
+echo $neo
+
+neo killall ttcp ping
+killall ttcp ping
+
+rm -f _*
+
+ttcp_rx
+ttcp_tx
+ping_rx
+ping_tx
Property changes on: developers/werner/wlan-perf/measure
___________________________________________________________________
Name: svn:executable
+ *
Added: developers/werner/wlan-perf/report
===================================================================
--- developers/werner/wlan-perf/report (rev 0)
+++ developers/werner/wlan-perf/report 2008-11-02 21:41:59 UTC (rev 4743)
@@ -0,0 +1,115 @@
+#!/usr/bin/perl
+
+
+sub extract_ttcp()
+{
+ local ($name, *bytes, *time, *csw) = @_;
+
+ open(F, $name) || die "$name: $!";
+ while (<F>) {
+ if (/ (\d+) bytes in (\S+) real seconds/) {
+ push(@bytes, $1);
+ push(@time, $2);
+ }
+ if (/ (\d+)\+(\d+)csw/) {
+ push(@csw, $1+$2);
+ }
+ }
+ close F;
+}
+
+
+sub ttcp_format()
+{
+ local ($rate, $csw) = @_;
+
+ return sprintf("%8.2f %7d", $rate/1000, $csw);
+}
+
+
+sub ttcp_set()
+{
+ local (*bytes, *time, *csw, $i) = @_;
+
+ $bytes += $bytes[$i];
+ $time += $time[$i];
+ $csw += $csw[$i];
+ return &ttcp_format($bytes[$i]/$time[$i], $csw[$i]);
+}
+
+
+sub report_ttcp()
+{
+ local ($label_tx, $label_rx, $tx, $rx) = @_;
+ local (@tx_bytes, @tx_time, @tx_csw);
+ local (@rx_bytes, @rx_time, @rx_csw);
+ local ($tx_bytes, $tx_time, $tx_csw);
+ local ($rx_bytes, $rx_time, $rx_csw);
+ local ($gap) = " " x 4;
+
+ print "---- ",
+ $label_tx, " ", "-" x (15-length $label_tx), $gap,
+ $label_rx, " ", "-" x (15-length $label_rx), "\n";
+ print " " x 5,
+ sprintf("%-8s %-7s", "kB/s", "ctx_sw"), $gap,
+ sprintf("%-8s %-7s", "kB/s", "ctx_sw"), "\n";
+
+ &extract_ttcp($tx, *tx_bytes, *tx_time, *tx_csw);
+ &extract_ttcp($rx, *rx_bytes, *rx_time, *rx_csw);
+ for ($i = 0; $i != @tx_bytes; $i++) {
+ print sprintf("%3d: ", $i+1),
+ &ttcp_set(*tx_bytes, *tx_time, *tx_csw, $i), $gap,
+ &ttcp_set(*rx_bytes, *rx_time, *rx_csw, $i), "\n";
+ }
+ print "AVG: ",
+ &ttcp_format($tx_bytes/$tx_time, $tx_csw/@tx_bytes), $gap,
+ &ttcp_format($rx_bytes/$rx_time, $rx_csw/@tx_bytes), "\n";
+ print "\n";
+}
+
+
+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;
+}
+
+
+sub report_ping()
+{
+ local ($title, $name) = @_;
+ local (@time);
+ local ($min, $max, $sum, $sq_sum, $avg);
+
+ @time = &extract_ping($name);
+ for (@time) {
+ $min = $_ if $_ < $min || !defined $min;
+ $max = $_ if $_ > $max || !defined $max;
+ $sum += $_;
+ $sq_sum += $_*$_;
+ }
+ $avg = $sum/@time;
+ print $title, ": ",
+ sprintf("%-7s/%-7s/%-7s %-7s", "min", "avg", "max", "stddev"),
+ sprintf(" (%d samples)", $#time+1), "\n";
+ print " " x length($title), " ",
+ sprintf("%7.2f", $min), "/",
+ sprintf("%7.2f", $avg), "/",
+ sprintf("%7.2f", $max), " ",
+ sprintf("%7.2f", sqrt($sq_sum/@time-$avg*$avg)), " ms\n";
+}
+
+
+&report_ttcp("host =>", "=> neo", "_rx_host", "_rx_neo");
+&report_ttcp("neo =>", "=> host", "_tx_neo", "_tx_host");
+&report_ping("host => neo", "_ping_rx");
+&report_ping("neo => host", "_ping_tx");
Property changes on: developers/werner/wlan-perf/report
___________________________________________________________________
Name: svn:executable
+ *
More information about the commitlog
mailing list