1 #!/bin/sh 2 # 3 # stream_range 4 # 5 # generate a whole lot of numbers from netperf to see the effects 6 # of send size on thruput 7 # 8 9 # 10 # usage : tcp_stream_range hostname [CPU] 11 # 12 13 if [ $# -gt 2 ]; then 14 echo "try again, correctly -> tcp_stream_range hostname [CPU]" 15 exit 1 16 fi 17 18 if [ $# -eq 0 ]; then 19 echo "try again, correctly -> tcp_stream_range hostname [CPU]" 20 exit 1 21 fi 22 23 # if there are two parms, parm one it the hostname and parm two will 24 # be a CPU indicator. actually, anything as a second parm will cause 25 # the CPU to be measured, but we will "advertise" it should be "CPU" 26 27 if [ $# -eq 2 ]; then 28 REM_HOST=$1 29 LOC_CPU="-c" 30 REM_CPU="-C" 31 fi 32 33 if [ $# -eq 1 ]; then 34 REM_HOST=$1 35 fi 36 37 # at what port will netserver be waiting? If you decide to run 38 # netserver at a differnet port than the default of 12865, then set 39 # the value of PORT apropriately 40 #PORT="-p some_other_portnum" 41 PORT="" 42 43 # where is netperf, and are there any "constant" options such as 44 # the netserver port number 45 #NETHOME=/usr/etc/net_perf 46 NETHOME="." 47 NETPERF=$NETHOME/netperf $PORT 48 49 # How accurate we want the estimate of performance: 50 # maximum and minimum test iterations (-i) 51 # confidence level (99 or 95) and interval (percent) 52 STATS_STUFF="-i 10,2 -I 99,3" 53 54 # 55 # some stuff for the arithmetic 56 # 57 # we start at start, and then multiply by MULT and add ADD. by changing 58 # these numbers, we can double each time, or increase by a fixed 59 # amount, or go up by 4x, whatever we like... 60 # 61 START=1 62 63 END=65536 64 65 MULT=4 66 67 ADD=0 68 69 # If we are measuring CPU utilization, then we can save beaucoup 70 # time by saving the results of the CPU calibration and passing 71 # them in during the real tests. So, we execute the new CPU "tests" 72 # of netperf and put the values into shell vars. 73 case $LOC_CPU in 74 \-c) LOC_RATE=`$NETPERF -t LOC_CPU`;; 75 *) LOC_RATE="" 76 esac 77 78 case $REM_CPU in 79 \-C) REM_RATE=`$NETPERF -t REM_CPU -H $REM_HOST`;; 80 *) REM_RATE="" 81 esac 82 83 TIME="60" 84 85 # 86 # the maximum socket buffer size is system dependent. for the 87 # "cannonical" tests we use 32KB, but this can be altered 88 # 89 SOCKET_SIZE="-s 32768 -S 32768" 90 91 MESSAGE=$START 92 while [ $MESSAGE -le $END ]; do 93 echo 94 echo ------------------------------------ 95 echo Testing with the following command line: 96 echo $NETPERF -l $TIME -H $REM_HOST -t TCP_STREAM\ 97 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\ 98 -m $MESSAGE $SOCKET_SIZE 99 echo 100 $NETPERF -l $TIME -H $REM_HOST -t TCP_STREAM\ 101 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\ 102 -m $MESSAGE $SOCKET_SIZE 103 104 MESSAGE=`expr $MESSAGE + $ADD` 105 MESSAGE=`expr $MESSAGE \* $MULT` 106 107 done 108 echo 109 110