1 |
#!/bin/sh
|
2 |
#
|
3 |
# 15 Feb, 2006: Adapted by L. Lueking from S. Veseli's SAM tests
|
4 |
#
|
5 |
# usage: ./run_cgi_client.sh nclients outputSuffix dspath
|
6 |
# example: ./run_cgi_client 10 test /a/b/c/d
|
7 |
nClients=$1
|
8 |
outputSuffix=$2
|
9 |
dspath=$3
|
10 |
nCalls=$4
|
11 |
|
12 |
# cft% : 5010 results
|
13 |
# sam% : 1359
|
14 |
cnt=0
|
15 |
echo "Using suffix: $outputSuffix"
|
16 |
echo "N clients: $nClients"
|
17 |
while [ "$cnt" != "$nClients" ]; do
|
18 |
cnt=`expr $cnt + 1`
|
19 |
outputFile=cgi_client.${cnt}.${outputSuffix}.out
|
20 |
cmd="./cgiLoadTest.py --dspath='$dspath' --n-calls=$nCalls --n-term=1 > $outputFile 2>&1 &"
|
21 |
echo "Executing: $cmd"
|
22 |
eval $cmd
|
23 |
done
|
24 |
|
25 |
|
26 |
# Allow for clients to be initialized
|
27 |
while true; do
|
28 |
attemptStr=`grep Attempt $outputFile`
|
29 |
if [ "$attemptStr" != "" ]; then
|
30 |
break
|
31 |
fi
|
32 |
sleep 1
|
33 |
done
|
34 |
startTime=`date +%s`
|
35 |
echo "Start time: $startTime"
|
36 |
cnt=0
|
37 |
while [ "$cnt" != "$nClients" ]; do
|
38 |
cnt=`expr $cnt + 1`
|
39 |
echo "Waiting for child #$cnt"
|
40 |
wait
|
41 |
done
|
42 |
endTime=`date +%s`
|
43 |
echo "End time: $endTime"
|
44 |
diff=`expr $endTime - $startTime`
|
45 |
echo "Time difference: $diff"
|
46 |
averageTime=`echo "$nClients $nCalls $diff" | awk '{print $3/($1 * $2)}'`
|
47 |
averagePyTime=`grep "Average Successful Call Duration" $outputFile | awk '{print $(NF-1)}'`
|
48 |
minPyTime=`grep "Minimum Call Duration" $outputFile | awk '{print $(NF-1)}'`
|
49 |
maxPyTime=`grep "Maximum Call Duration" $outputFile | awk '{print $(NF-1)}'`
|
50 |
echo "Minimum Call Time (Python): $minPyTime"
|
51 |
echo "Maximum Call Time (Python): $maxPyTime"
|
52 |
echo "Number of Clients/Average Call Time (Python): $nClients $averagePyTime"
|
53 |
echo "Number of Clients/Average Call Time: $nClients $averageTime"
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|