summaryrefslogtreecommitdiff
path: root/maintenance/mctest.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/mctest.php')
-rw-r--r--maintenance/mctest.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/maintenance/mctest.php b/maintenance/mctest.php
index 3667cb93..651b2958 100644
--- a/maintenance/mctest.php
+++ b/maintenance/mctest.php
@@ -21,7 +21,7 @@
* @ingroup Maintenance
*/
-require_once( dirname(__FILE__) . '/Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class mcTest extends Maintenance {
public function __construct() {
@@ -36,36 +36,36 @@ class mcTest extends Maintenance {
global $wgMemCachedServers;
$iterations = $this->getOption( 'i', 100 );
- if( $this->hasArg() )
+ if ( $this->hasArg() )
$wgMemCachedServers = array( $this->getArg() );
foreach ( $wgMemCachedServers as $server ) {
- $this->output( $server . " " );
- $mcc = new MemCachedClientforWiki( array('persistant' => true) );
+ $this->output( $server . " ", $server );
+ $mcc = new MemCachedClientforWiki( array( 'persistant' => true ) );
$mcc->set_servers( array( $server ) );
$set = 0;
$incr = 0;
$get = 0;
$time_start = $this->microtime_float();
- for ( $i=1; $i<=$iterations; $i++ ) {
+ for ( $i = 1; $i <= $iterations; $i++ ) {
if ( !is_null( $mcc->set( "test$i", $i ) ) ) {
$set++;
}
}
- for ( $i=1; $i<=$iterations; $i++ ) {
+ for ( $i = 1; $i <= $iterations; $i++ ) {
if ( !is_null( $mcc->incr( "test$i", $i ) ) ) {
$incr++;
}
}
- for ( $i=1; $i<=$iterations; $i++ ) {
+ for ( $i = 1; $i <= $iterations; $i++ ) {
$value = $mcc->get( "test$i" );
- if ( $value == $i*2 ) {
+ if ( $value == $i * 2 ) {
$get++;
}
}
$exectime = $this->microtime_float() - $time_start;
-
- $this->output( "set: $set incr: $incr get: $get time: $exectime\n" );
+
+ $this->output( "set: $set incr: $incr get: $get time: $exectime", $server );
}
}
@@ -74,10 +74,10 @@ class mcTest extends Maintenance {
* @return float
*/
private function microtime_float() {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
+ list( $usec, $sec ) = explode( " ", microtime() );
+ return ( (float)$usec + (float)$sec );
}
}
$maintClass = "mcTest";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );