Skip to content

Commit 4a64560

Browse files
committed
Only calculate output data if specifically requested (fixes #36)
1 parent eb5ecbf commit 4a64560

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

benchmarks/_functions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ benchmark ()
88

99
echo "ab -c 10 -t 3 $url"
1010
ab -c 10 -t 3 "$url" > "$ab_log"
11-
curl --dump-header "$benchmark_data" "$url" > "$output"
11+
curl -H 'X-Include-Benchmark-Output-Data: 1' --dump-header "$benchmark_data" "$url" > "$output"
1212

1313
rps=`grep "Requests per second:" "$ab_log" | cut -f 7 -d " "`
1414
memory=`grep "X-Benchmark-Output-Data:" "$benchmark_data" | cut -f 2 -d ':' | cut -f 2 -d ' '`

libs/output_data.php

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
// Only calculate output data if specifically requested
4+
$headers = getallheaders();
5+
if (!isset($headers["X-Include-Benchmark-Output-Data"])) {
6+
return;
7+
}
8+
39
// Get benchmark output data
410
$real_usage = null;
511
if (defined('HHVM_VERSION')) {

0 commit comments

Comments
 (0)