When saving preferences, check hook and authentication plugin, and actually save...
[mediawiki.git] / maintenance / mctest.php
blob6446d14faf38ecd960a071d527edd76eb8b1b780
1 <?php
2 /* $Id$ */
4 $optionsWithArgs = array( 'i' );
6 require_once('commandLine.inc');
8 function microtime_float()
10 list($usec, $sec) = explode(" ", microtime());
11 return ((float)$usec + (float)$sec);
15 #$wgDebugLogFile = '/dev/stdout';
17 if ( isset( $args[0] ) ) {
18 $wgMemCachedServers = array( $args[0] );
20 if ( isset( $options['i'] ) ) {
21 $iterations = $options['i'];
22 } else {
23 $iterations = 100;
26 foreach ( $wgMemCachedServers as $server ) {
27 print "$server ";
28 $mcc = new MemCachedClientforWiki( array('persistant' => true) );
29 $mcc->set_servers( array( $server ) );
30 $set = 0;
31 $incr = 0;
32 $get = 0;
33 $time_start=microtime_float();
34 for ( $i=1; $i<=$iterations; $i++ ) {
35 if ( !is_null( $mcc->set( "test$i", $i ) ) ) {
36 $set++;
40 for ( $i=1; $i<=$iterations; $i++ ) {
41 if ( !is_null( $mcc->incr( "test$i", $i ) ) ) {
42 $incr++;
46 for ( $i=1; $i<=$iterations; $i++ ) {
47 $value = $mcc->get( "test$i" );
48 if ( $value == $i*2 ) {
49 $get++;
52 $exectime=microtime_float()-$time_start;
54 print "set: $set incr: $incr get: $get time: $exectime\n";