From c293d90acb11a17b208f2aecf055ed5b598cebc4 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 6 Sep 2012 19:47:17 +0200 Subject: [PATCH] Remove usage of wfTime() in benchmarks and backupTextPassTest.php Left the usage in GlobalTest.php since these are tests for that function. This function is only a wrapper to microtime( true ), so it can easily be replaced and deprecated at some point. Change-Id: I4f7c1f6705e10e2664f8e9be51d86ed5c8ff1e1c --- maintenance/benchmarks/Benchmarker.php | 4 ++-- maintenance/benchmarks/bench_delete_truncate.php | 8 ++++---- maintenance/benchmarks/benchmarkHooks.php | 4 ++-- maintenance/benchmarks/benchmarkPurge.php | 4 ++-- tests/phpunit/maintenance/backupTextPassTest.php | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/maintenance/benchmarks/Benchmarker.php b/maintenance/benchmarks/Benchmarker.php index 9901b37d10..c198e0ff3e 100644 --- a/maintenance/benchmarks/Benchmarker.php +++ b/maintenance/benchmarks/Benchmarker.php @@ -53,11 +53,11 @@ abstract class Benchmarker extends Maintenance { } $bench_number++; - $start = wfTime(); + $start = microtime( true ); for( $i=0; $i<$count; $i++ ) { call_user_func_array( $bench['function'], $bench['args'] ); } - $delta = wfTime() - $start; + $delta = microtime( true ) - $start; // function passed as a callback if( is_array( $bench['function'] ) ) { diff --git a/maintenance/benchmarks/bench_delete_truncate.php b/maintenance/benchmarks/bench_delete_truncate.php index a8e4627bcb..31d517fe1b 100644 --- a/maintenance/benchmarks/bench_delete_truncate.php +++ b/maintenance/benchmarks/bench_delete_truncate.php @@ -46,22 +46,22 @@ class BenchmarkDeleteTruncate extends Benchmarker { $this->insertData( $dbw ); - $start = wfTime(); + $start = microtime( true ); $this->delete( $dbw ); - $end = wfTime(); + $end = microtime( true ); echo "Delete: " . $end - $start; echo "\r\n"; $this->insertData( $dbw ); - $start = wfTime(); + $start = microtime( true ); $this->truncate( $dbw ); - $end = wfTime(); + $end = microtime( true ); echo "Truncate: " . $end - $start; echo "\r\n"; diff --git a/maintenance/benchmarks/benchmarkHooks.php b/maintenance/benchmarks/benchmarkHooks.php index 9d116017f9..9de7610dc0 100644 --- a/maintenance/benchmarks/benchmarkHooks.php +++ b/maintenance/benchmarks/benchmarkHooks.php @@ -65,11 +65,11 @@ class BenchmarkHooks extends Benchmarker { * @return string */ private function benchHooks( $trials = 10 ) { - $start = wfTime(); + $start = microtime( true ); for ( $i = 0; $i < $trials; $i++ ) { wfRunHooks( 'Test' ); } - $delta = wfTime() - $start; + $delta = microtime( true ) - $start; $pertrial = $delta / $trials; return sprintf( "Took %6.2fs", $pertrial ); diff --git a/maintenance/benchmarks/benchmarkPurge.php b/maintenance/benchmarks/benchmarkPurge.php index 7ef2116392..ec686b2a00 100644 --- a/maintenance/benchmarks/benchmarkPurge.php +++ b/maintenance/benchmarks/benchmarkPurge.php @@ -62,11 +62,11 @@ class BenchmarkPurge extends Benchmarker { * @return string */ private function benchSquid( $urls, $trials = 1 ) { - $start = wfTime(); + $start = microtime( true ); for ( $i = 0; $i < $trials; $i++ ) { SquidUpdate::purge( $urls ); } - $delta = wfTime() - $start; + $delta = microtime( true ) - $start; $pertrial = $delta / $trials; $pertitle = $pertrial / count( $urls ); return sprintf( "%4d titles in %6.2fms (%6.2fms each)", diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index f669b26e21..a0bbadf991 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -250,9 +250,9 @@ class TextPassDumperTest extends DumpTestCase { $dumper->stderr = $stderr; // The actual dump and taking time - $ts_before = wfTime(); + $ts_before = microtime( true ); $dumper->dump( WikiExporter::FULL, WikiExporter::TEXT ); - $ts_after = wfTime(); + $ts_after = microtime( true ); $lastDuration = $ts_after - $ts_before; // Handling increasing the iteration count for the stubs -- 2.20.1