#!/bin/bash
-> curl_log.txt
-TRACE="--trace-ascii curl_log.txt"
-SERVER=`cat .httpServer`
burstMargin__dflt=1
salir () {
echo
echo " resume:"
echo " Resume an stopped burst launch from the same point (start will reset"
- echo " the work pointer to the first burst list position). This is equivalent"
+ echo " the work pointer to the first burst list position). This is equivalent"
echo " to one-message-push operation."
echo
echo " repeat [[yes] | no]:"
echo " Show programmed burst message for order provided."
echo
echo
- salir
-}
-
-_curl () {
- curl -m 5 --data "$1" $TRACE ${SERVER}
+ salir
}
echo
echo
[[ "$1" = "" ]] && uso
case $1 in
- clear) _curl "burst|clear"
+ clear) ./operation.sh "burst|clear"
;;
load) [[ "$3" = "" ]] && uso
[[ ! -f "${3}.sh" ]] && salir "Burst generation file '${3}.sh' not found!"
then
count=$2
RESTO=$((count%4))
- [[ "$RESTO" != "0" ]] && salir "Data context should load a multiple of 4 (messages generated by data.sh)"
+ [[ "$RESTO" != "0" ]] && salir "Data context should load a multiple of 4 (messages generated by data.sh)"
fi
count=1
while test "$count" -le "$2"
do
${3}.sh $count > .${3}.xml
echo -n "Loading message ${count}; "
- _curl "burst|load|.${3}.xml"
+ ./operation.sh "burst|load|.${3}.xml"
count=$((count+1))
done
;;
start) load=$burstMargin__dflt
[[ "$2" != "" ]] && load=$2
entero $load
- _curl "burst|start|$load"
+ ./operation.sh "burst|start|$load"
;;
pop) release=$burstMargin__dflt
[[ "$2" != "" ]] && release=$2
entero $release
- _curl "burst|pop|$release"
+ ./operation.sh "burst|pop|$release"
;;
push) [[ "$2" = "" ]] && uso
entero $2
- _curl "burst|push|$2"
+ ./operation.sh "burst|push|$2"
;;
- stop) _curl "burst|stop"
+ stop) ./operation.sh "burst|stop"
;;
- resume) _curl "burst|push|1"
+ resume) ./operation.sh "burst|push|1"
;;
repeat) repeat=yes
[[ "$2" != "" ]] && repeat=$2
- _curl "burst|repeat|$repeat"
+ ./operation.sh "burst|repeat|$repeat"
;;
send) amount=1
[[ "$2" != "" ]] && amount=$2
entero $amount
- _curl "burst|send|$amount"
+ ./operation.sh "burst|send|$amount"
;;
sendXS) [[ "$2" = "" ]] && uso
limit=$3
TPS=$READ_TPS
[[ "$TPS" = "0" ]] && salir "Test stopped due to 0-tps value read"
# Background:
- _curl "burst|send|$amount" &
+ ./operation.sh "burst|send|$amount" &
count=$((count+amount))
AFTER_ns=`date +%s%N`
# Real tps:
REAL_TPS=$(calc "1000000000 * $count / ($AFTER_ns - $BEGIN_ns)")
echo $REAL_TPS > .real_tps
-
+
COEF=1
[[ $(calc "$TPS > $REAL_TPS") = "1" ]] && COEF=$(calc "$REAL_TPS / $TPS")
K=$(calc "$COEF ^ 10")
;;
goto) [[ "$2" = "" ]] && uso
entero $2
- _curl "burst|goto|$2"
+ ./operation.sh "burst|goto|$2"
;;
look) [[ "$2" = "" ]] && uso
entero $2
- _curl "burst|look|$2"
+ ./operation.sh "burst|look|$2"
;;
*) uso
esac