Remove usage of wfTime() in benchmarks and backupTextPassTest.php
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 6 Sep 2012 17:47:17 +0000 (19:47 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 6 Sep 2012 17:47:17 +0000 (19:47 +0200)
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
maintenance/benchmarks/bench_delete_truncate.php
maintenance/benchmarks/benchmarkHooks.php
maintenance/benchmarks/benchmarkPurge.php
tests/phpunit/maintenance/backupTextPassTest.php

index 9901b37..c198e0f 100644 (file)
@@ -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'] ) ) {
index a8e4627..31d517f 100644 (file)
@@ -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";
index 9d11601..9de7610 100644 (file)
@@ -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 );
index 7ef2116..ec686b2 100644 (file)
@@ -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)",
index f669b26..a0bbadf 100644 (file)
@@ -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