MediaWiki
1.34.0
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
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition:
Maintenance.php:348
BenchWfIsWindows\__construct
__construct()
Default constructor.
Definition:
bench_wfIsWindows.php:35
Benchmarker\bench
bench(array $benchs)
Definition:
Benchmarker.php:50
BenchWfIsWindows\wfIsWindows
wfIsWindows()
Definition:
bench_wfIsWindows.php:52
BenchWfIsWindows
Maintenance script that benchmarks wfIsWindows().
Definition:
bench_wfIsWindows.php:34
BenchWfIsWindows\is_win
static is_win()
Definition:
bench_wfIsWindows.php:47
Benchmarker
Base class for benchmark scripts.
Definition:
Benchmarker.php:40
$maintClass
$maintClass
Definition:
bench_wfIsWindows.php:67
BenchWfIsWindows\wfIsWindowsCached
wfIsWindowsCached()
Definition:
bench_wfIsWindows.php:57
BenchWfIsWindows\execute
execute()
Do the actual work.
Definition:
bench_wfIsWindows.php:40
maintenance
benchmarks
bench_wfIsWindows.php
Generated on Thu Dec 19 2019 14:55:24 for MediaWiki by
1.8.16