launch.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/sh -x
  2. # profile filename
  3. PREF=$1
  4. # number of cycles
  5. NROFCYCLES=4
  6. # functions to go into report
  7. MYFN="eat_line|eat_space|eat_token"
  8. # set to non-zero if only a report is to be generated
  9. #REPONLY=tru
  10. CONFIG=profile.cfg
  11. SRD=${HOME}/sip_router
  12. PRO=${SRD}/profile
  13. REP=$PRO/$PREF.txt
  14. EXEC=ser
  15. function usage()
  16. {
  17. cat << EOF
  18. usage: $0 profile_name
  19. currently, this script starts a remote sender at alioth.
  20. The sender iterates through all messages available in its
  21. directory and send them many times (should be configurable).
  22. Sip-router is configured to relay requests to benetnash:sink
  23. and responses are built to be routed there too.
  24. This repeats NROFCYCLES-times. Results of all cycles are then
  25. dumped into <profile_name>-<cycle number>.txt and a
  26. report <profile_name>.txt is generated.
  27. EOF
  28. exit 1
  29. }
  30. if [ "$#" -ne 1 ] ; then
  31. usage
  32. fi
  33. cd $SRD
  34. function run()
  35. {
  36. j=0
  37. while [ $j -lt "$NROFCYCLES" ] ; do
  38. i=`printf "%.3d" $j`
  39. j=`expr $j + 1`
  40. echo "*** Entering cycle $j"
  41. /usr/bin/time --output="$PRO/${PREF}-${i}-time.txt" ${SRD}/$EXEC -l 192.168.99.100 -D -E -d -f ${PRO}/$CONFIG &
  42. #rsh -l jku benetnash.fokus.gmd.de 'nohup bin/sock -s -u 5060 '
  43. rsh -l jku alioth.fokus.gmd.de 'nohup tmp/sipp/start.sh '
  44. killall -INT $EXEC
  45. gprof $EXEC > $PRO/${PREF}-${i}.txt
  46. done
  47. }
  48. function report()
  49. {
  50. cat > $REP << EOF
  51. first line ... time spent in tested procedure
  52. second line (yyrestart) ... total time
  53. third line (receive_msg) ... numer of calls
  54. % cumulative self self total
  55. time seconds seconds calls ms/call ms/call name
  56. EOF
  57. j=0
  58. while [ $j -lt "$NROFCYCLES" ] ; do
  59. i=`printf "%.3d" $j`
  60. j=`expr $j + 1`
  61. FN="${PRO}/${PREF}-${i}.txt"
  62. echo >> $REP
  63. echo >> $REP
  64. echo $FN >> $REP
  65. egrep "($MYFN|yyrestart)" $FN | grep -v '\[' >> $REP
  66. grep 'receive_msg \[.\]' $FN | grep -v '\/' >> $REP
  67. echo >> $REP
  68. cat $PRO/${PREF}-${i}-time.txt >> $REP
  69. done
  70. cat >> $REP << EOF
  71. Execution environment:
  72. EOF
  73. cat /proc/cpuinfo /proc/meminfo >> $REP
  74. }
  75. if [ -z "$REPONLY" ] ; then
  76. run
  77. fi
  78. report
  79. echo '*** finished ***'
  80. echo