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 $wgMemCachedServers[] = 'localhost';
22 if ( isset( $options['i'] ) ) {
23 $iterations = $options['i'];
28 foreach ( $wgMemCachedServers as $server ) {
30 $mcc = new MemCachedClientforWiki( array('persistant' => true) );
31 $mcc->set_servers( array( $server ) );
35 $time_start=microtime_float();
36 for ( $i=1; $i<=$iterations; $i++
) {
37 if ( !is_null( $mcc->set( "test$i", $i ) ) ) {
42 for ( $i=1; $i<=$iterations; $i++
) {
43 if ( !is_null( $mcc->incr( "test$i", $i ) ) ) {
48 for ( $i=1; $i<=$iterations; $i++
) {
49 $value = $mcc->get( "test$i" );
50 if ( $value == $i*2 ) {
54 $exectime=microtime_float()-$time_start;
56 print "set: $set incr: $incr get: $get time: $exectime\n";