2 echo " sendXS <requests per second> [amount: default -1 (no limit)]:"
3 echo " send messages from burst list with the TPS provided. User could hot change"
4 echo " speed by mean 'echo <TPS> > .tps' at another shell. You can stop the load"
5 echo " removing that hidden file or using CTRL+C from the shell where you launched"
6 echo " the burst command. Real tps is dumped on '.real_tps' file during testing."
7 echo " You could limit the amount of messages sent by mean the second parameter."
8 echo " No limit is established by default (-1 or negative value)."
10 TRACE="--trace-ascii curl_log.txt"
11 SERVER=`cat .httpServer`
15 echo "Use: $0 <xml_file> [2c]"
17 echo "Sends 'xml_file' to the diameter server or to the client when '2c' parameter is provided."
22 sendXS) [[ "$2" = "" ]] && uso
24 [[ "$limit" = "" ]] && limit=-1
33 [[ "$count" = "$limit" ]] && break
34 BEFORE_ns=`date +%s%N`
36 # Hot change could make .tps still unavailable:
37 [[ "$READ_TPS" = "" ]] && READ_TPS=$TPS
38 # Volvemos a calcular medias (REAL_TPS) cada 10 segundos o cuando cambia el TPS en caliente:
39 [[ "$READ_TPS" != "$TPS" ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; }
40 [[ $count = $((10*TPS)) ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; }
42 [[ "$TPS" = "0" ]] && salir "Test stopped due to 0-tps value read"
44 _curl "burst|send|$amount" &
45 count=$((count+amount))
48 REAL_TPS=$(calc "1000000000 * $count / ($AFTER_ns - $BEGIN_ns)")
49 echo $REAL_TPS > .real_tps
52 [[ $(calc "$TPS > $REAL_TPS") = "1" ]] && COEF=$(calc "$REAL_TPS / $TPS")
53 K=$(calc "$COEF ^ 10")
54 amount=$(calc "scale=0;1/$K")
55 usleep $(calc "$K * 1000000/$TPS")
59 [[ "$1" = "" ]] && use
60 [[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
62 operation="sendxml2e|$1"
63 [[ "$2" = "2c" ]] && operation="sendxml2c|$1"
65 curl -m 1 --data "$operation" $TRACE ${SERVER}