17cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes#!/bin/sh 27cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# 37cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# This is an example script for using netperf. Feel free to modify it 47cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# as necessary, but I would suggest that you copy this one first. 57cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# 67cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# This version has been modified to take advantage of the confidence 77cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# interval support in revision 2.0 of netperf. it has also been altered 87cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# to make submitting its resutls to the netperf database easier 97cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# raj 11/94 107cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# 117cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# usage: tcp_stream_script hostname [CPU] 127cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# 137cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 147cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesif [ $# -gt 2 ]; then 157cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo "try again, correctly -> sctp_stream_script hostname [CPU]" 167cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes exit 1 177cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesfi 187cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 197cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesif [ $# -eq 0 ]; then 207cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo "try again, correctly -> sctp_stream_script hostname [CPU]" 217cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes exit 1 227cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesfi 237cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 247cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# where the programs are 257cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes#NETHOME=/usr/local/netperf 267cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes#NETHOME="/opt/netperf" 277cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesNETHOME=. 287cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 297cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# at what port will netserver be waiting? If you decide to run 307cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# netserver at a differnet port than the default of 12865, then set 317cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# the value of PORT apropriately 327cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes#PORT="-p some_other_portnum" 337cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesPORT="" 347cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 357cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# The test length in seconds 367cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesTEST_TIME=60 377cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 387cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# How accurate we want the estimate of performance: 397cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# maximum and minimum test iterations (-i) 407cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# confidence level (99 or 95) and interval (percent) 417cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesSTATS_STUFF="-i 10,2 -I 99,5" 427cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 437cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# The socket sizes that we will be testing 447cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesSOCKET_SIZES="57344 32768 8192" 457cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 467cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# The send sizes that we will be using 477cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesSEND_SIZES="4096 8192 32768" 487cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 497cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# if there are two parms, parm one it the hostname and parm two will 507cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# be a CPU indicator. actually, anything as a second parm will cause 517cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# the CPU to be measured, but we will "advertise" it should be "CPU" 527cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 537cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesif [ $# -eq 2 ]; then 547cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes REM_HOST=$1 557cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes LOC_CPU="-c" 567cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes REM_CPU="-C" 577cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesfi 587cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 597cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesif [ $# -eq 1 ]; then 607cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes REM_HOST=$1 617cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesfi 627cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 637cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# If we are measuring CPU utilization, then we can save beaucoup 647cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# time by saving the results of the CPU calibration and passing 657cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# them in during the real tests. So, we execute the new CPU "tests" 667cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# of netperf and put the values into shell vars. 677cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughescase $LOC_CPU in 687cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;; 697cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes*) LOC_RATE="" 707cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesesac 717cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 727cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughescase $REM_CPU in 737cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;; 747cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes*) REM_RATE="" 757cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesesac 767cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 777cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes# this will disable headers 787cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott HughesNO_HDR="-P 0" 797cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 807cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughesfor SOCKET_SIZE in $SOCKET_SIZES 817cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes do 827cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes for SEND_SIZE in $SEND_SIZES 837cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes do 847cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo 857cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo ------------------------------------ 867cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo 877cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes # we echo the command line for cut and paste 887cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t SCTP_STREAM\ 897cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\ 907cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes -m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE 917cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 927cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes echo 937cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes # since we have the confidence interval stuff, we do not 947cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes # need to repeat a test multiple times from the shell 957cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t SCTP_STREAM\ 967cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\ 977cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes -m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE 987cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes 997cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes done 1007cb62816f02cc6abb1fe88b94808fc412e0b29d0Elliott Hughes done 101