MediaWiki
REL1_35
ProfilerOutputStats.php
Go to the documentation of this file.
1
<?php
20
use
MediaWiki\MediaWikiServices
;
21
28
class
ProfilerOutputStats
extends
ProfilerOutput
{
29
35
public
function
log
( array $stats ) {
36
$prefix = $this->params[
'prefix'
] ??
''
;
37
$contextStats = MediaWikiServices::getInstance()->getStatsdDataFactory();
38
39
foreach
( $stats as $stat ) {
40
$key =
"{$prefix}.{$stat['name']}"
;
41
42
// Convert fractional seconds to whole milliseconds
43
$cpu = round( $stat[
'cpu'
] * 1000 );
44
$real = round( $stat[
'real'
] * 1000 );
45
46
$contextStats->increment(
"{$key}.calls"
);
47
$contextStats->timing(
"{$key}.cpu"
, $cpu );
48
$contextStats->timing(
"{$key}.real"
, $real );
49
}
50
}
51
}
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition
MediaWikiServices.php:152
ProfilerOutputStats
Flush profiling data to StatsD.
Definition
ProfilerOutputStats.php:28
ProfilerOutputStats\log
log(array $stats)
Flush profiling data to the current profiling context's stats buffer.
Definition
ProfilerOutputStats.php:35
ProfilerOutput
Base class for profiling output.
Definition
ProfilerOutput.php:27
includes
profiler
output
ProfilerOutputStats.php
Generated on Sat Apr 6 2024 00:07:40 for MediaWiki by
1.9.8