Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 19:31:52 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217021 - stable/8/tools/tools/mctest
Message-ID:  <201101051931.p05JVqYw088731@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Wed Jan  5 19:31:52 2011
New Revision: 217021
URL: http://svn.freebsd.org/changeset/base/217021

Log:
  MFC: 213327
  
  Change the output of mctest to give a summary of the results instead
  of printing a long list.
  
  Add a default base port, and default mulitcast address to the
  runner script.
  
  Add support for specifying a different local and remote interface
  in the runner script.

Modified:
  stable/8/tools/tools/mctest/mctest.cc
  stable/8/tools/tools/mctest/mctest_run.sh
Directory Properties:
  stable/8/tools/tools/mctest/   (props changed)

Modified: stable/8/tools/tools/mctest/mctest.cc
==============================================================================
--- stable/8/tools/tools/mctest/mctest.cc	Wed Jan  5 19:26:30 2011	(r217020)
+++ stable/8/tools/tools/mctest/mctest.cc	Wed Jan  5 19:31:52 2011	(r217021)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 // C++ STL and other related includes
 #include <iostream>
 #include <string>
+#include <vector>
+#include <algorithm>
 
 // Operating System and other C based includes
 #include <unistd.h>
@@ -400,15 +402,31 @@ int source(char *interface, struct in_ad
     }
 
     timeval result;
+    vector<int> deltas;
+    double idx[] = { .0001, .001, .01, .1, .5, .9, .99, .999, .9999, 0.0 };
+
     for (int client = 0;client < clients; client++) {
+	deltas.clear();
 	cout << "Results from client #" << client << endl;
+	cout << "in usecs" << endl;
         for (int i = 0; i < number; i++) {
-	    if (i % clients != client) 
-		continue;
+// 	    if (i % clients != client) 
+// 		continue;
+            if (&args[client].packets[i].tv_sec == 0)
+			continue;
 	    timersub(&args[client].packets[i], &sent[i], &result);
-	    cout << "sec: " << result.tv_sec;
-	    cout << " usecs: " << result.tv_usec << endl;
+	    deltas.push_back(result.tv_usec);
+// 	    cout << "sec: " << result.tv_sec;
+// 	    cout << " usecs: " << result.tv_usec << endl;
             }
+	cout << "comparing %lu deltas" << long(deltas.size()) << endl;
+	cout << "number represents usecs of round-trip time" << endl;
+	sort(deltas.begin(), deltas.end());
+	for (int i = 0; idx[i] != 0; ++i) {
+		printf("%s% 5d", (i == 0) ? "" : " ", 
+		       deltas[(int) (idx[i] * deltas.size())]); 
+	}
+	printf("\n");		
     }
 
     return 0;

Modified: stable/8/tools/tools/mctest/mctest_run.sh
==============================================================================
--- stable/8/tools/tools/mctest/mctest_run.sh	Wed Jan  5 19:26:30 2011	(r217020)
+++ stable/8/tools/tools/mctest/mctest_run.sh	Wed Jan  5 19:31:52 2011	(r217021)
@@ -7,19 +7,19 @@
 # Defaults
 size=1024
 number=100
-base=""
-group=""
+base=9999
+group="239.255.255.101"
 interface="cxgb0"
 remote="ssh"
-command="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest"
+command="/zoo/tank/users/gnn/svn/Projects/head-exar/src/tools/tools/mctest/mctest"
 gap=1000
 
 # Arguments are s (size), g (group), n (number), and c (command) followed
 # by a set of hostnames.
-args=`getopt s:g:n:c:i:b: $*`
+args=`getopt s:g:n:c:l:f:b: $*`
 if [ $? != 0 ]
 then
-    echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 host2 hostN'
+    echo 'Usage: mctest_run -l local_interface -f foreign_interface -s size -g group -n number -c remote command host1 host2 hostN'
     exit 2
 fi
 set == $args
@@ -40,8 +40,11 @@ do
       -c)
 	  command=$3;
 	  shift 2;;
-      -i)
-	  interface=$3;
+      -l)
+	  local_interface=$3;
+	  shift 2;;
+      -f)
+	  foreign_interface=$3;
 	  shift 2;;
       -b) 
 	  base=$3;
@@ -60,7 +63,7 @@ now=`date "+%Y%m%d%H%M"`
 for host in $*
 do
   output=$host\_$interface\_$size\_$number\.$now
-  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $interface > $output &
+  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $foreign_interface > $output &
   sleep 1
   current=`expr $current + 1 `;
 done
@@ -68,4 +71,4 @@ done
 #
 # Start the source/collector on this machine
 #
-$command -M $# -b $base -g $group -n $number -s $size -i $interface -t $gap > `uname -n`\_$size\_$number\.$now
+$command -M $# -b $base -g $group -n $number -s $size -i $local_interface -t $gap > `uname -n`\_$size\_$number\.$now



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101051931.p05JVqYw088731>