MediaWiki
1.34.0
ProfilerOutputStats.php
Go to the documentation of this file.
1
<?php
24
use
MediaWiki\MediaWikiServices
;
25
33
class
ProfilerOutputStats
extends
ProfilerOutput
{
34
40
public
function
log
( array $stats ) {
41
$prefix = $this->params[
'prefix'
] ??
''
;
42
$contextStats = MediaWikiServices::getInstance()->getStatsdDataFactory();
43
44
foreach
( $stats as $stat ) {
45
$key =
"{$prefix}.{$stat['name']}"
;
46
47
// Convert fractional seconds to whole milliseconds
48
$cpu = round( $stat[
'cpu'
] * 1000 );
49
$real = round( $stat[
'real'
] * 1000 );
50
51
$contextStats->increment(
"{$key}.calls"
);
52
$contextStats->timing(
"{$key}.cpu"
, $cpu );
53
$contextStats->timing(
"{$key}.real"
, $real );
54
}
55
}
56
}
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition:
MediaWikiServices.php:117
ProfilerOutputStats\log
log(array $stats)
Flush profiling data to the current profiling context's stats buffer.
Definition:
ProfilerOutputStats.php:40
ProfilerOutputStats
ProfilerOutput class that flushes profiling data to the profiling context's stats buffer.
Definition:
ProfilerOutputStats.php:33
ProfilerOutput
Base class for profiling output.
Definition:
ProfilerOutput.php:27
includes
profiler
output
ProfilerOutputStats.php
Generated on Thu Dec 19 2019 14:54:43 for MediaWiki by
1.8.16