1#!/bin/sh
2#
3# This is an example script for using netperf. Feel free to modify it 
4# as necessary, but I would suggest that you copy this one first.
5# 
6# This version has been modified to take advantage of the confidence
7# interval support in revision 2.0 of netperf. it has also been altered
8# to make submitting its resutls to the netperf database easier
9# raj 11/94
10#
11# usage: tcp_stream_script hostname [CPU]
12#
13
14if [ $# -gt 2 ]; then
15  echo "try again, correctly -> tcp_stream_script hostname [CPU]"
16  exit 1
17fi
18
19if [ $# -eq 0 ]; then
20  echo "try again, correctly -> tcp_stream_script hostname [CPU]"
21  exit 1
22fi
23
24# where the programs are
25#NETHOME=/usr/local/netperf
26#NETHOME="/opt/netperf"
27NETHOME=.
28
29# at what port will netserver be waiting? If you decide to run
30# netserver at a differnet port than the default of 12865, then set
31# the value of PORT apropriately
32#PORT="-p some_other_portnum"
33PORT=""
34
35# The test length in seconds
36TEST_TIME=60
37
38# How accurate we want the estimate of performance: 
39#      maximum and minimum test iterations (-i)
40#      confidence level (99 or 95) and interval (percent)
41STATS_STUFF="-i 10,2 -I 99,5"
42
43# The socket sizes that we will be testing
44SOCKET_SIZES="57344 32768 8192"
45
46# The send sizes that we will be using
47SEND_SIZES="4096 8192 32768"
48
49# if there are two parms, parm one it the hostname and parm two will
50# be a CPU indicator. actually, anything as a second parm will cause
51# the CPU to be measured, but we will "advertise" it should be "CPU"
52
53if [ $# -eq 2 ]; then
54  REM_HOST=$1
55  LOC_CPU="-c"
56  REM_CPU="-C"
57fi
58
59if [ $# -eq 1 ]; then
60  REM_HOST=$1
61fi
62
63# If we are measuring CPU utilization, then we can save beaucoup
64# time by saving the results of the CPU calibration and passing
65# them in during the real tests. So, we execute the new CPU "tests"
66# of netperf and put the values into shell vars.
67case $LOC_CPU in
68\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
69*) LOC_RATE=""
70esac
71
72case $REM_CPU in
73\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
74*) REM_RATE=""
75esac
76
77# this will disable headers
78NO_HDR="-P 0"
79
80for SOCKET_SIZE in $SOCKET_SIZES
81  do
82  for SEND_SIZE in $SEND_SIZES
83    do
84    echo
85    echo ------------------------------------
86    echo
87    # we echo the command line for cut and paste 
88    echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_STREAM\
89         $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
90         -m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
91
92    echo
93    # since we have the confidence interval stuff, we do not
94    # need to repeat a test multiple times from the shell
95    $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_STREAM\
96    $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
97    -m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
98
99    done
100  done
101echo If you wish to submit these results to the netperf database at
102echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
103echo datapoint individually. Individual datapoints are separated by
104echo lines of dashes. 
105