Skip to content

Commit f069974

Browse files
committed
Storing results separately for each stack
1 parent 88ce5eb commit f069974

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

benchmark.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/sh
22

3-
base="http://127.0.0.1/php-framework-benchmark"
3+
# exit on failure
4+
set -e
5+
6+
if [ "$stack" = "" ]; then
7+
stack="local"
8+
fi
49

510
cd `dirname $0`
611

@@ -14,6 +19,6 @@ fi
1419

1520
cd benchmarks
1621

17-
sh hello_world.sh "$base"
22+
sh hello_world.sh "$stack"
1823

1924
php ../bin/show_results_table.php

benchmarks/_functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ benchmark ()
22
{
33
fw="$1"
44
url="$2"
5-
ab_log="output/$fw.ab.log"
6-
output="output/$fw.output"
5+
ab_log="$output_dir/$fw.ab.log"
6+
output="$output_dir/$fw.output"
77

88
echo "ab -c 10 -t 3 $url"
99
ab -c 10 -t 3 "$url" > "$ab_log"

benchmarks/hello_world.sh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
#!/bin/sh
22

3+
# exit on failure
4+
set -e
5+
36
cd `dirname $0`
47
. ./_functions.sh
58

6-
base="$1"
9+
stack="$1"
710
bm_name=`basename $0 .sh`
811

9-
results_file="output/results.$bm_name.log"
10-
check_file="output/check.$bm_name.log"
11-
error_file="output/error.$bm_name.log"
12-
url_file="output/urls.log"
12+
if [ "$stack" = "local" ]; then
13+
base="http://127.0.0.1/php-framework-benchmark"
14+
fi
15+
if [ "$stack" = "docker_nginx_php_5_6_4" ]; then
16+
base="http://nginx_php_5_6_4"
17+
fi
18+
if [ "$stack" = "docker_nginx_hhvm_3_10_1" ]; then
19+
base="http://nginx_hhvm_3_10_1"
20+
fi
21+
if [ "$stack" = "docker_nginx_php_7_0_0" ]; then
22+
base="http://nginx_php_7_0_0"
23+
fi
24+
25+
output_dir="output/$stack"
26+
27+
results_file="$output_dir/results.$bm_name.log"
28+
check_file="$output_dir/check.$bm_name.log"
29+
error_file="$output_dir/error.$bm_name.log"
30+
url_file="$output_dir/urls.log"
1331

1432
cd ..
1533

16-
mv "$results_file" "$results_file.old"
17-
mv "$check_file" "$check_file.old"
18-
mv "$error_file" "$error_file.old"
19-
mv "$url_file" "$url_file.old"
34+
mkdir -p "$output_dir"
35+
36+
mv "$results_file" "$results_file.old" || true
37+
mv "$check_file" "$check_file.old" || true
38+
mv "$error_file" "$error_file.old" || true
39+
mv "$url_file" "$url_file.old" || true
2040

2141
for fw in `echo $targets`
2242
do

bin/show_results_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require __DIR__ . '/../libs/parse_results.php';
44
require __DIR__ . '/../libs/build_table.php';
55

6-
$results = parse_results(__DIR__ . '/../output/results.hello_world.log');
6+
$results = parse_results(__DIR__ . '/../output/' . getenv('stack') . '/results.hello_world.log');
77
//var_dump($results);
88

99
echo build_table($results);

0 commit comments

Comments
 (0)