MediaWiki  REL1_20
bench_wfIsWindows.php
Go to the documentation of this file.
00001 <?php
00027 require_once( __DIR__ . '/Benchmarker.php' );
00028 
00034 class bench_wfIsWindows extends Benchmarker {
00035 
00036         public function __construct() {
00037                 parent::__construct();
00038                 $this->mDescription = "Benchmark for wfIsWindows.";
00039         }
00040 
00041         public function execute() {
00042                 $this->bench( array(
00043                         array( 'function' => array( $this, 'wfIsWindows' ) ),
00044                         array( 'function' => array( $this, 'wfIsWindowsCached' ) ),
00045                 ));
00046                 print $this->getFormattedResults();
00047         }
00048 
00049         static function is_win() {
00050                 return substr( php_uname(), 0, 7 ) == 'Windows' ;
00051         }
00052 
00053         // bench function 1
00054         function wfIsWindows() {
00055                 return self::is_win();
00056         }
00057 
00058         // bench function 2
00059         function wfIsWindowsCached() {
00060                 static $isWindows = null;
00061                 if( $isWindows == null ) {
00062                         $isWindows = self::is_win();
00063                 }
00064                 return $isWindows;
00065         }
00066 }
00067 
00068 $maintClass = 'bench_wfIsWindows';
00069 require_once( RUN_MAINTENANCE_IF_MAIN );