From c6d2924dda45b7759b35ac4cae555aaadfabb7ab Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 22 Sep 2012 12:10:41 -0700 Subject: [PATCH] Added "parallelize" option to file performance test script. Change-Id: I6f32b5964c44339d0fe192f9c25edee484de9dfa --- maintenance/fileOpPerfTest.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/maintenance/fileOpPerfTest.php b/maintenance/fileOpPerfTest.php index 501bcfc389..d98cfe3f78 100644 --- a/maintenance/fileOpPerfTest.php +++ b/maintenance/fileOpPerfTest.php @@ -40,7 +40,8 @@ class TestFileOpPerformance extends Maintenance { $this->addOption( 'b2', 'Backend 2', false, true ); $this->addOption( 'srcdir', 'File source directory', true, true ); $this->addOption( 'maxfiles', 'Max files', false, true ); - $this->addOption( 'quick', 'Avoid operation pre-checks' ); + $this->addOption( 'quick', 'Avoid operation pre-checks (use doQuickOperations())' ); + $this->addOption( 'parallelize', '"parallelize" flag for doOperations()', false, true ); } public function execute() { @@ -95,8 +96,13 @@ class TestFileOpPerformance extends Maintenance { $method = $this->hasOption( 'quick' ) ? 'doQuickOperations' : 'doOperations'; + $opts = array( 'force' => 1 ); + if ( $this->hasOption( 'parallelize' ) ) { + $opts['parallelize'] = ( $this->getOption( 'parallelize' ) === 'true' ); + } + $start = microtime( true ); - $status = $backend->$method( $ops1, array( 'force' => 1 ) ); + $status = $backend->$method( $ops1, $opts ); $e = ( microtime( true ) - $start ) * 1000; if ( $status->getErrorsArray() ) { print_r( $status->getErrorsArray() ); @@ -105,7 +111,7 @@ class TestFileOpPerformance extends Maintenance { $this->output( $backend->getName() . ": Stored " . count( $ops1 ) . " files in $e ms.\n" ); $start = microtime( true ); - $backend->$method( $ops2, array( 'force' => 1 ) ); + $backend->$method( $ops2, $opts ); $e = ( microtime( true ) - $start ) * 1000; if ( $status->getErrorsArray() ) { print_r( $status->getErrorsArray() ); @@ -114,7 +120,7 @@ class TestFileOpPerformance extends Maintenance { $this->output( $backend->getName() . ": Copied " . count( $ops2 ) . " files in $e ms.\n" ); $start = microtime( true ); - $backend->$method( $ops3, array( 'force' => 1 ) ); + $backend->$method( $ops3, $opts ); $e = ( microtime( true ) - $start ) * 1000; if ( $status->getErrorsArray() ) { print_r( $status->getErrorsArray() ); @@ -123,7 +129,7 @@ class TestFileOpPerformance extends Maintenance { $this->output( $backend->getName() . ": Moved " . count( $ops3 ) . " files in $e ms.\n" ); $start = microtime( true ); - $backend->$method( $ops4, array( 'force' => 1 ) ); + $backend->$method( $ops4, $opts ); $e = ( microtime( true ) - $start ) * 1000; if ( $status->getErrorsArray() ) { print_r( $status->getErrorsArray() ); @@ -132,7 +138,7 @@ class TestFileOpPerformance extends Maintenance { $this->output( $backend->getName() . ": Deleted " . count( $ops4 ) . " files in $e ms.\n" ); $start = microtime( true ); - $backend->$method( $ops5, array( 'force' => 1 ) ); + $backend->$method( $ops5, $opts ); $e = ( microtime( true ) - $start ) * 1000; if ( $status->getErrorsArray() ) { print_r( $status->getErrorsArray() ); -- 2.20.1