Author: gnn
Date: Fri Oct  1 14:36:36 2010
New Revision: 213327
URL: http://svn.freebsd.org/changeset/base/213327

Log:
  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.
  
  MFC after:    1 week

Modified:
  head/tools/tools/mctest/mctest.cc
  head/tools/tools/mctest/mctest_run.sh

Modified: head/tools/tools/mctest/mctest.cc
==============================================================================
--- head/tools/tools/mctest/mctest.cc   Fri Oct  1 13:10:11 2010        
(r213326)
+++ head/tools/tools/mctest/mctest.cc   Fri Oct  1 14:36:36 2010        
(r213327)
@@ -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: head/tools/tools/mctest/mctest_run.sh
==============================================================================
--- head/tools/tools/mctest/mctest_run.sh       Fri Oct  1 13:10:11 2010        
(r213326)
+++ head/tools/tools/mctest/mctest_run.sh       Fri Oct  1 14:36:36 2010        
(r213327)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to