r4756 - developers/werner/wlan-perf

werner at docs.openmoko.org werner at docs.openmoko.org
Thu Nov 6 00:17:27 CET 2008


Author: werner
Date: 2008-11-06 00:17:27 +0100 (Thu, 06 Nov 2008)
New Revision: 4756

Modified:
   developers/werner/wlan-perf/report
Log:
Skip measurements for which no file is available.



Modified: developers/werner/wlan-perf/report
===================================================================
--- developers/werner/wlan-perf/report	2008-11-05 23:07:07 UTC (rev 4755)
+++ developers/werner/wlan-perf/report	2008-11-05 23:17:27 UTC (rev 4756)
@@ -5,7 +5,10 @@
 {
     local ($name, *rate, *csw, *cpu) = @_;
 
-    open(F, $name) || die "$name: $!";
+    if (!open(F, $name)) {
+	print STDERR "$name: $!\n";
+	return undef;
+    }
     while (<F>) {
 	if (/ (\d+) bytes in (\S+) real seconds/) {
 	    push(@rate, $1/$2);
@@ -18,6 +21,7 @@
 	}
     }
     close F;
+    return 1;
 }
 
 
@@ -80,6 +84,9 @@
     local ($gap) = " " x 4;
     local ($n);
 
+    return unless &extract_ttcp($tx, *tx_rate, *tx_csw, *tx_cpu);
+    return unless &extract_ttcp($rx, *rx_rate, *rx_csw, *rx_cpu);
+
     print "---- ",
        $label_tx, " ", "-" x (15-length $label_tx), $gap,
        $label_rx, " ", "-" x (15-length $label_rx), "\n";
@@ -87,22 +94,22 @@
       sprintf("%-8s %-7s CPU ", "*1000B/s", "ctx_sw"), $gap,
       sprintf("%-8s %-7s CPU ", "*1000B/s", "ctx_sw"), "\n";
 
-    &extract_ttcp($tx, *tx_rate, *tx_csw, *tx_cpu);
-    &extract_ttcp($rx, *rx_rate, *rx_csw, *rx_cpu);
     $n = @tx_rate;
     for ($i = 0; $i != $n; $i++) {
 	print sprintf("%3d: ", $i+1),
 	  &ttcp_set(*tx_rate, *tx_csw, *tx_cpu, $i), $gap,
 	  &ttcp_set(*rx_rate, *rx_csw, *rx_cpu, $i), "\n";
     }
-    print "AVG: ",
-      &ttcp_format($tx_rate/$n, $tx_csw/$n, $tx_cpu/$n), $gap,
-      &ttcp_format($rx_rate/$n, $rx_csw/$n, $rx_cpu/$n), "\n";
-    print "SDV: ",
-      &ttcp_format(&ttcp_std_dev(*tx_rate, $n),
-      &ttcp_std_dev(*tx_csw, $n), &ttcp_std_dev(*tx_cpu, $n)), $gap,
-      &ttcp_format(&ttcp_std_dev(*rx_rate, $n),
-      &ttcp_std_dev(*rx_csw, $n), &ttcp_std_dev(*rx_cpu, $n)), "\n";
+    if ($n) {
+	print "AVG: ",
+	  &ttcp_format($tx_rate/$n, $tx_csw/$n, $tx_cpu/$n), $gap,
+	  &ttcp_format($rx_rate/$n, $rx_csw/$n, $rx_cpu/$n), "\n";
+	print "SDV: ",
+	  &ttcp_format(&ttcp_std_dev(*tx_rate, $n),
+	  &ttcp_std_dev(*tx_csw, $n), &ttcp_std_dev(*tx_cpu, $n)), $gap,
+	  &ttcp_format(&ttcp_std_dev(*rx_rate, $n),
+	  &ttcp_std_dev(*rx_csw, $n), &ttcp_std_dev(*rx_cpu, $n)), "\n";
+    }
     print "\n";
 }
 
@@ -112,7 +119,10 @@
     local ($name) = @_;
     local (@time);
 
-    open(F, $name) || die "$name: $!";
+    if (!open(F, $name)) {
+	print STDERR "$name: $!\n";
+	return ();
+    }
     while (<F>) {
 	if (/ time=(\S+) ms/) {
 	    push(@time, $1);
@@ -130,6 +140,8 @@
     local ($min, $max, $sum, $sq_sum, $avg);
 
     @time = &extract_ping($name);
+    return unless @time;
+
     for (@time) {
 	$min = $_ if $_ < $min || !defined $min;
 	$max = $_ if $_ > $max || !defined $max;




More information about the commitlog mailing list