Follow up r75446 : simpler bench function, correct parenthesis.
[lhc/web/wiklou.git] / maintenance / benchmarks / bench_wfIsWindows.php
1 <?php
2 /**
3 * This come from r75429 message
4 * @author Platonides
5 */
6
7 require_once( dirname( __FILE__ ) . '/Benchmarker.php' );
8 class bench_wfIsWindows extends Benchmarker {
9
10 public function __construct() {
11 parent::__construct();
12 }
13
14 public function execute() {
15 $this->bench( array(
16 array( 'function' => array( $this, 'wfIsWindows' ) ),
17 array( 'function' => array( $this, 'wfIsWindowsCached' ) ),
18 ));
19 print $this->getFormattedResults();
20 }
21
22 static function is_win() {
23 return substr( php_uname(), 0, 7 ) == 'Windows' ;
24 }
25
26 // bench function 1
27 function wfIsWindows() {
28 return self::is_win();
29 }
30
31 // bench function 2
32 function wfIsWindowsCached() {
33 static $isWindows = null;
34 if( $isWindows == null ) {
35 $isWindows = self::is_win();
36 }
37 return $isWindows;
38 }
39 }
40
41 $maintClass = 'bench_wfIsWindows';
42 require_once( DO_MAINTENANCE );