1 #!/bin/sh 2 #set -x 3 # 4 # This is a script to generate a quick "snapshot" of performance for a 5 # pair of nodes. At first, it will perform the following tests: 6 # 7 # TCP Stream test with 56KB socket buffers and 4KB sends 8 # TCP Stream test with 32KB socket buffers and 4KB sends 9 # TCP Request/Response test with 1 byte requests and 1 byte responses 10 # UDP Request/Response test with 1 byte requests and 1 byte responses 11 # UDP Request/Response test with 516 byte requests and 4 byte responses 12 # UDP Stream test with 32KB socket buffers and 4KB sends 13 # UDP Stream test with 32KB socket buffers and 1KB sends 14 # 15 # All tests will run for sixty seconds. Confidence intervals are used 16 # to insure the repeatability of the test. This means that the soonest 17 # the script will be finished is 21 minutes. 18 # 19 # This script takes two parameters. The first parm is the name of the 20 # remote host. It is a required parameter. The second will either 21 # enable or disable CPU utilization measurements. It is an optional 22 # parameter which defaults to no CPU utilization measurements. 23 # 24 # usage: snapshot_script hostname [CPU] 25 # 26 # mod 6/29/95 - echo progress information to stderr so that we can 27 # see forward progress even when the results are 28 # re-directed to a file 29 # 30 # mod 5/27/96 - switch from NETHOME to NETPERF and take the user's value 31 # if it is already set 32 # 33 # mod 8/12/96 - fix the default netperf command variable so it finds the 34 # executable and not the directory... 35 # 36 # First, let us set-up some of the defaults 37 # 38 # where is netperf installed, there are a few possible places: 39 40 NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf} 41 42 43 # there should be no more than two parms passed 44 45 if [ $# -gt 2 ]; then 46 echo "try again, correctly -> snapshot_script hostname [CPU]" 47 exit 1 48 fi 49 50 if [ $# -eq 0 ]; then 51 echo "try again, correctly -> snapshot_script hostname [CPU]" 52 exit 1 53 fi 54 55 # if there are two parms, parm one it the hostname and parm two will 56 # be a CPU indicator. actuall, anything as a second parm will cause 57 # the CPU to be measured, but we will "advertise" it should be "CPU" 58 59 if [ $# -eq 2 ]; then 60 REM_HOST=$1 61 LOC_CPU="-c" 62 REM_CPU="-C" 63 fi 64 65 if [ $# -eq 1 ]; then 66 REM_HOST=$1 67 fi 68 69 # at what port will netserver be waiting? If you decide to run 70 # netserver at a differnet port than the default of 12865, then set 71 # the value of PORT apropriately 72 #NETPERF_PORT="-p some_other_portnum" 73 NETPERF_PORT=${NETPERF_PORT:=""} 74 75 # How accurate we want the estimate of performance: 76 # maximum and minimum test iterations (-i) 77 # confidence level (99 or 95) and interval (percent) 78 STATS_STUFF="-i 10,3 -I 99,5" 79 80 # length in time of the test - should be 60 seconds 81 NETPERF_TIME=${NETPERF_TIME:=60} 82 83 # where is the bitbucket? 84 BITBUCKET="/dev/null" 85 86 # announce start of test 87 echo Netperf snapshot script started at `date` >&2 88 89 # If we are measuring CPU utilization, then we can save beaucoup time 90 # by saving the results of the CPU calibration and passing them in 91 # during the real tests. So, we execute the new CPU "tests" of netperf 92 # and put the values into shell vars. 93 94 case $LOC_CPU in 95 \-c) LOC_RATE=`$NETPERF_CMD $NETPERF_PORT -t LOC_CPU`;; 96 *) LOC_RATE="" 97 esac 98 99 case $REM_CPU in 100 \-C) REM_RATE=`$NETPERF_CMD $NETPERF_PORT -t REM_CPU -H $REM_HOST`;; 101 *) REM_RATE="" 102 esac 103 104 # We will perform three twenty second warm-up tests at this point, but 105 # we will not display the results of those tests. This is unlikely to 106 # make any difference in the results except right after a system 107 # reboot, but this is supposed to be rather "general." We will do a 108 # TCP stream and a TCP req/resp test 109 110 WARM_TIME="10" 111 112 $NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \ 113 -s 32768 -S 32768 -m 4096 > ${BITBUCKET} 114 $NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \ 115 -s 32768 -S 32768 -m 96 > ${BITBUCKET} 116 $NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_RR -H $REM_HOST -- \ 117 -r 1,1 > ${BITBUCKET} 118 119 # The warm-ups are complete, so perform the real tests first, the 120 # stream tests, then the request/response 121 122 echo Starting 56x4 TCP_STREAM tests at `date` >&2 123 124 # a 56x4 TCP_STREAM test 125 echo 126 echo ------------------------------------ 127 echo Testing with the following command line: 128 echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 129 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 130 -s 57344 -S 57344 -m 4096 131 echo 132 $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 133 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 134 -s 57344 -S 57344 -m 4096 135 echo 136 echo 137 # a 32x4 TCP_STREAM test 138 echo Starting 32x4 TCP_STREAM tests at `date` >&2 139 echo 140 echo ------------------------------------ 141 echo Testing with the following command line: 142 echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 143 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 144 -s 32768 -S 32768 -m 4096 145 echo 146 $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 147 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 148 -s 32768 -S 32768 -m 4096 149 echo 150 echo 151 # a single-byte TCP_RR 152 echo Starting 1,1 TCP_RR tests at `date` >&2 153 echo 154 echo ------------------------------------ 155 echo Testing with the following command line: 156 echo $NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \ 157 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 158 -r 1,1 159 echo 160 $NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \ 161 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 162 -r 1,1 163 echo 164 echo 165 echo Starting 1,1 UDP_RR tests at `date` >&2 166 echo 167 echo ------------------------------------ 168 echo Testing with the following command line: 169 # a single-byte UDP_RR 170 echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \ 171 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 172 -r 1,1 173 echo 174 $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \ 175 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 176 -r 1,1 177 echo 178 echo 179 # a UDP_RR test much like tftp 180 echo Starting 512,4 UDP_RR tests at `date` >&2 181 echo 182 echo ------------------------------------ 183 echo Testing with the following command line: 184 echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \ 185 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 186 -r 516,4 187 echo 188 $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \ 189 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- -r 516,4 190 # a 32x4 UDP_STREAM test 191 echo Starting 32x4 UDP_STREAM tests at `date` >&2 192 echo 193 echo ------------------------------------ 194 echo Testing with the following command line: 195 echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 196 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 197 -s 32768 -S 32768 -m 4096 198 echo 199 $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 200 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 201 -s 32768 -S 32768 -m 4096 202 echo 203 echo 204 # a 32x1 UDP_STREAM test 205 echo Starting 32x1 UDP_STREAM tests at `date` >&2 206 echo 207 echo ------------------------------------ 208 echo Testing with the following command line: 209 echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 210 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 211 -s 32768 -S 32768 -m 1024 212 echo 213 $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \ 214 $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \ 215 -s 32768 -S 32768 -m 1024 216 echo 217 echo 218 219 # and that's that 220 echo Tests completed at `date` >&2 221 222 echo 223