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