Skip to content

Commit cd9a90f

Browse files
committed
The "time" result is taken from 10 request (average)
1 parent d43f2c2 commit cd9a90f

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

benchmarks/_functions.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@ benchmark ()
55
ab_log="output/$fw.ab.log"
66
output="output/$fw.output"
77

8+
# get rpm
89
echo "ab -c 10 -t 3 $url"
910
ab -c 10 -t 3 "$url" > "$ab_log"
10-
curl "$url" > "$output"
11-
1211
rps=`grep "Requests per second:" "$ab_log" | cut -f 7 -d " "`
12+
13+
# get time
14+
count=10
15+
total=0
16+
for ((i=0; i < $count; i++)); do
17+
curl "$url" > "$output"
18+
t=`tail -1 "$output" | cut -f 2 -d ':'`
19+
total=`php ./benchmarks/sum_ms.php $t $total`
20+
done
21+
time=`php ./benchmarks/avg_ms.php $total $count`
22+
23+
# get memory and file
1324
memory=`tail -1 "$output" | cut -f 1 -d ':'`
14-
time=`tail -1 "$output" | cut -f 2 -d ':'`
1525
file=`tail -1 "$output" | cut -f 3 -d ':'`
26+
1627
echo "$fw: $rps: $memory: $time: $file" >> "$results_file"
1728

1829
echo "$fw" >> "$check_file"

benchmarks/avg_ms.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$total = $argv[1];
4+
$count = $argv[2];
5+
6+
echo $total / $count;

benchmarks/sum_ms.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$ms = $argv[1];
4+
$total = $argv[2];
5+
6+
echo $ms + $total;

0 commit comments

Comments
 (0)