From: Alexandre Emsenhuber Date: Thu, 6 Sep 2012 20:06:46 +0000 (+0200) Subject: Make benmark duration output more prettier. X-Git-Tag: 1.31.0-rc.0~22407 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/message.php?a=commitdiff_plain;h=581bcbe31002b77146ce3d2bff676db1d8a8ecc3;p=lhc%2Fweb%2Fwiklou.git Make benmark duration output more prettier. - 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 --- diff --git a/maintenance/benchmarks/bench_delete_truncate.php b/maintenance/benchmarks/bench_delete_truncate.php index 31d517fe1b..d9741496f5 100644 --- a/maintenance/benchmarks/bench_delete_truncate.php +++ b/maintenance/benchmarks/bench_delete_truncate.php @@ -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' ); diff --git a/maintenance/benchmarks/benchmarkHooks.php b/maintenance/benchmarks/benchmarkHooks.php index 9de7610dc0..fdb016f41a 100644 --- a/maintenance/benchmarks/benchmarkHooks.php +++ b/maintenance/benchmarks/benchmarkHooks.php @@ -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 ); } /**