Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5978179
ProfilerOutputStats.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ProfilerOutputStats.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
use
MediaWiki\MediaWikiServices
;
/**
* Flush profiling data to StatsD.
*
* @ingroup Profiler
* @since 1.25
*/
class
ProfilerOutputStats
extends
ProfilerOutput
{
/**
* Flush profiling data to the current profiling context's stats buffer.
*
* @param array[] $stats
*/
public
function
log
(
array
$stats
)
{
$prefix
=
$this
->
params
[
'prefix'
]
??
''
;
$statsFactory
=
MediaWikiServices
::
getInstance
()->
getStatsFactory
();
$posCounter
=
$statsFactory
->
getCounter
(
'ProfilerOutputStats_calls_total'
);
$posCpuTimer
=
$statsFactory
->
getTiming
(
'ProfilerOutputStats_cpu_seconds'
);
$posRealTimer
=
$statsFactory
->
getTiming
(
'ProfilerOutputStats_real_seconds'
);
foreach
(
$stats
as
$stat
)
{
$key
=
$prefix
?
"{$prefix}_{$stat['name']}"
:
"{$stat['name']}"
;
// Convert fractional seconds to whole milliseconds
$cpu
=
round
(
$stat
[
'cpu'
]
*
1000
);
$real
=
round
(
$stat
[
'real'
]
*
1000
);
$posCounter
->
setLabel
(
'key'
,
$key
)->
increment
();
$posCpuTimer
->
setLabel
(
'key'
,
$key
)->
observe
(
$cpu
);
$posRealTimer
->
setLabel
(
'key'
,
$key
)->
observe
(
$real
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:17 (3 d, 13 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5f/af/811e7328378cd352f6b20c86cb78
Default Alt Text
ProfilerOutputStats.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment