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