MediaWiki
REL1_34
bench_wfIsWindows.php
Go to the documentation of this file.
1
<?php
27
require_once __DIR__ .
'/Benchmarker.php'
;
28
34
class
BenchWfIsWindows
extends
Benchmarker
{
35
public
function
__construct
() {
36
parent::__construct();
37
$this->
addDescription
(
'Benchmark for wfIsWindows.'
);
38
}
39
40
public
function
execute
() {
41
$this->
bench
( [
42
[
'function'
=> [ $this,
'wfIsWindows'
] ],
43
[
'function'
=> [ $this,
'wfIsWindowsCached'
] ],
44
] );
45
}
46
47
protected
static
function
is_win
() {
48
return
substr( php_uname(), 0, 7 ) ==
'Windows'
;
49
}
50
51
// bench function 1
52
protected
function
wfIsWindows
() {
53
return
self::is_win
();
54
}
55
56
// bench function 2
57
protected
function
wfIsWindowsCached
() {
58
static
$isWindows =
null
;
59
if
( $isWindows ==
null
) {
60
$isWindows =
self::is_win
();
61
}
62
63
return
$isWindows;
64
}
65
}
66
67
$maintClass
= BenchWfIsWindows::class;
68
require_once
RUN_MAINTENANCE_IF_MAIN
;
RUN_MAINTENANCE_IF_MAIN
const RUN_MAINTENANCE_IF_MAIN
Definition
Maintenance.php:39
$maintClass
$maintClass
Definition
bench_wfIsWindows.php:67
BenchWfIsWindows
Maintenance script that benchmarks wfIsWindows().
Definition
bench_wfIsWindows.php:34
BenchWfIsWindows\execute
execute()
Do the actual work.
Definition
bench_wfIsWindows.php:40
BenchWfIsWindows\wfIsWindows
wfIsWindows()
Definition
bench_wfIsWindows.php:52
BenchWfIsWindows\wfIsWindowsCached
wfIsWindowsCached()
Definition
bench_wfIsWindows.php:57
BenchWfIsWindows\is_win
static is_win()
Definition
bench_wfIsWindows.php:47
BenchWfIsWindows\__construct
__construct()
Default constructor.
Definition
bench_wfIsWindows.php:35
Benchmarker
Base class for benchmark scripts.
Definition
Benchmarker.php:40
Benchmarker\bench
bench(array $benchs)
Definition
Benchmarker.php:50
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:348
maintenance
benchmarks
bench_wfIsWindows.php
Generated on Fri Apr 5 2024 23:11:04 for MediaWiki by
1.9.8