MediaWiki REL1_35
ProfilerOutputStats.php
Go to the documentation of this file.
1<?php
21
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}
MediaWikiServices is the service locator for the application scope of MediaWiki.
Flush profiling data to StatsD.
log(array $stats)
Flush profiling data to the current profiling context's stats buffer.
Base class for profiling output.