Browse Source

Incorporate PR 664 via ptarjan:hhvm

nareshv 11 years ago
parent
commit
2cd7e7ade0
6 changed files with 50 additions and 26 deletions
  1. 6 2
      hhvm/db.php
  2. 6 2
      hhvm/fortunes.php
  3. 6 2
      hhvm/json.php
  4. 6 2
      hhvm/plaintext.php
  5. 13 9
      hhvm/queries.php
  6. 13 9
      hhvm/updates.php

+ 6 - 2
hhvm/db.php

@@ -5,5 +5,9 @@
 
 
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-$b = new Benchmark();
-$b->bench_db();
+function main() {
+    $b = new Benchmark();
+    $b->bench_db();
+}
+
+main();

+ 6 - 2
hhvm/fortunes.php

@@ -5,5 +5,9 @@
 
 
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-$b = new Benchmark();
-$b->bench_fortunes();
+function main() {
+    $b = new Benchmark();
+    $b->bench_fortunes();
+}
+
+main();

+ 6 - 2
hhvm/json.php

@@ -3,5 +3,9 @@
 // 1. JSON Test
 // 1. JSON Test
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-$b = new Benchmark();
-$b->bench_json();
+function main() {
+    $b = new Benchmark();
+    $b->bench_json();
+}
+
+main();

+ 6 - 2
hhvm/plaintext.php

@@ -3,5 +3,9 @@
 // 6. Plaintext Test
 // 6. Plaintext Test
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-$b = new Benchmark();
-$b->bench_plaintext();
+function main() {
+    $b = new Benchmark();
+    $b->bench_plaintext();
+}
+
+main();

+ 13 - 9
hhvm/queries.php

@@ -5,14 +5,18 @@
 
 
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-// Read number of queries to run from URL parameter
-$query_count = 1;
-if (!empty($_GET['queries'])) {
-  $query_count = intval($_GET['queries']);
-}
+function main() {
+    // Read number of queries to run from URL parameter
+    $query_count = 1;
+    if (!empty($_GET['queries'])) {
+      $query_count = intval($_GET['queries']);
+    }
+
+    // Fix the queries limits
+    $query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
 
 
-// Fix the queries limits
-$query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
+    $b = new Benchmark();
+    $b->bench_queries($query_count);
+}
 
 
-$b = new Benchmark();
-$b->bench_queries($query_count);
+main();

+ 13 - 9
hhvm/updates.php

@@ -5,14 +5,18 @@
 
 
 require_once dirname(__FILE__).'/once.php.inc';
 require_once dirname(__FILE__).'/once.php.inc';
 
 
-// Read number of queries to run from URL parameter
-$query_count = 1;
-if (!empty($_GET['queries'])) {
-  $query_count = intval($_GET['queries']);
-}
+function main() {
+    // Read number of queries to run from URL parameter
+    $query_count = 1;
+    if (!empty($_GET['queries'])) {
+      $query_count = intval($_GET['queries']);
+    }
+
+    // Fix the queries limits
+    $query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
 
 
-// Fix the queries limits
-$query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
+    $b = new Benchmark();
+    $b->bench_updates($query_count);
+}
 
 
-$b = new Benchmark();
-$b->bench_updates($query_count);
+main();