8 $optionsWithArgs = array( 'i' );
10 require_once('commandLine.inc');
12 function microtime_float()
14 list($usec, $sec) = explode(" ", microtime());
15 return ((float)$usec +
(float)$sec);
19 #$wgDebugLogFile = '/dev/stdout';
21 if ( isset( $args[0] ) ) {
22 $wgMemCachedServers = array( $args[0] );
24 if ( isset( $options['i'] ) ) {
25 $iterations = $options['i'];
30 foreach ( $wgMemCachedServers as $server ) {
32 $mcc = new MemCachedClientforWiki( array('persistant' => true) );
33 $mcc->set_servers( array( $server ) );
37 $time_start=microtime_float();
38 for ( $i=1; $i<=$iterations; $i++
) {
39 if ( !is_null( $mcc->set( "test$i", $i ) ) ) {
44 for ( $i=1; $i<=$iterations; $i++
) {
45 if ( !is_null( $mcc->incr( "test$i", $i ) ) ) {
50 for ( $i=1; $i<=$iterations; $i++
) {
51 $value = $mcc->get( "test$i" );
52 if ( $value == $i*2 ) {
56 $exectime=microtime_float()-$time_start;
58 print "set: $set incr: $incr get: $get time: $exectime\n";