MediaWiki
REL1_39
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
Service locator for MediaWiki core services.
Definition
MediaWikiServices.php:212
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:30
includes
profiler
output
ProfilerOutputStats.php
Generated on Fri Dec 20 2024 15:35:01 for MediaWiki by
1.10.0