tcp_stream_script
Upload User: kvgkvg
Upload Date: 2015-05-07
Package Size: 1129k
Code Size: 3k
Development Platform:

C/C++

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