Make benmark duration output more prettier.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 6 Sep 2012 20:06:46 +0000 (22:06 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 11 Sep 2012 17:31:01 +0000 (17:31 +0000)
- Output miliseconds instead of second, much easier to read without
  a bunch of leading zeros
- Give precision up to the microsecond in benchmarkHooks

Change-Id: Id47e55eb311c926757c50a432c8992999908c03e

maintenance/benchmarks/bench_delete_truncate.php
maintenance/benchmarks/benchmarkHooks.php

index 31d517f..d974149 100644 (file)
@@ -52,7 +52,7 @@ class BenchmarkDeleteTruncate extends Benchmarker {
 
                $end = microtime( true );
 
-               echo "Delete: " . $end - $start;
+               echo "Delete: " . sprintf( "%6.3fms", ( $end - $start ) * 1000 );
                echo "\r\n";
 
                $this->insertData( $dbw );
@@ -63,7 +63,7 @@ class BenchmarkDeleteTruncate extends Benchmarker {
 
                $end = microtime( true );
 
-               echo "Truncate: " . $end - $start;
+               echo "Truncate: " . sprintf( "%6.3fms", ( $end - $start ) * 1000 );
                echo "\r\n";
 
                $dbw->dropTable( 'test' );
index 9de7610..fdb016f 100644 (file)
@@ -71,8 +71,8 @@ class BenchmarkHooks extends Benchmarker {
                }
                $delta = microtime( true ) - $start;
                $pertrial = $delta / $trials;
-               return sprintf( "Took %6.2fs",
-                       $pertrial );
+               return sprintf( "Took %6.3fms",
+                       $pertrial * 1000 );
        }
 
        /**