udp_rr_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. #
  6. #
  7. # uncomment the next line if you think the script is broken
  8. #set -x
  9. if [ $# -gt 2 ]; then
  10.   echo "try again, correctly -> udp_rr_script hostname [CPU]"
  11.   exit 1
  12. fi
  13. if [ $# -eq 0 ]; then
  14.   echo "try again, correctly -> udp_rr_script hostname [CPU]"
  15.   exit 1
  16. fi
  17. # where the programs are
  18. #NETHOME=/usr/local/netperf
  19. #NETHOME="/opt/netperf"
  20. NETHOME="."
  21. # at what port will netserver be waiting? If you decide to run
  22. # netserver at a differnet port than the default of 12865, then set
  23. # the value of PORT apropriately
  24. #PORT="-p some_other_portnum"
  25. PORT=""
  26. # The test length in seconds
  27. TEST_TIME=60
  28. # How accurate we want the estimate of performance: 
  29. #      maximum and minimum test iterations (-i)
  30. #      confidence level (99 or 95) and interval (percent)
  31. STATS_STUFF="-i 10,2 -I 99,10"
  32. # The socket sizes that we will be testing - -1 means use default
  33. # not much point in changing the socket buffer for a UDP request/
  34. # response test - unless you want to have requests/responses which 
  35. # are larger than the default
  36. SOCKET_SIZES="-1"
  37. # The send sizes that we will be using
  38. RR_SIZES="1,1 64,64 100,200 1024,1024"
  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.   LOC_CPU=""
  49.   REM_CPU=""
  50.   REM_HOST=$1
  51. fi
  52. # If we are measuring CPU utilization, then we can save beaucoup
  53. # time by saving the results of the CPU calibration and passing
  54. # them in during the real tests. So, we execute the new CPU "tests"
  55. # of netperf and put the values into shell vars.
  56. case $LOC_CPU in
  57. -c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
  58. *) LOC_RATE=""
  59. esac
  60. case $REM_CPU in
  61. -C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
  62. *) REM_RATE=""
  63. esac
  64. # This turns-off the display headers
  65. NO_HDR="-P 0"
  66. for SOCKET_SIZE in $SOCKET_SIZES
  67. do
  68.   for RR_SIZE in $RR_SIZES
  69.   do
  70.   echo
  71.   echo ------------------------------------------------------
  72.   echo Testing with the following command line:
  73.   echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF 
  74.                   $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_RR --
  75.                   -r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
  76.   $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF 
  77.     $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_RR $NO_HDR --
  78.                   -r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
  79.   done
  80. done
  81. echo
  82. echo If you wish to submit these results to the netperf database at
  83. echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
  84. echo datapoint individually. Individual datapoints are separated by
  85. echo lines of dashes.