$wgProfiler = array( 'class' => 'ProfilerSimpleText' );
error_reporting( E_ALL );
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
/**
* Maintenance script to test fileop performance.
$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() {
$profiler = Profiler::instance();
$profiler->setTemplated( true );
- $profiler->logData(); // prints
+
+ //NOTE: as of MW1.21, $profiler->logData() is called implicitly by doMaintenance.php.
}
protected function doPerfTest( FileBackend $backend ) {
$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() );
$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() );
$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() );
$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() );
$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() );