Manual:$wgProfiler

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
English • ‎dansk • ‎español • ‎polski • ‎中文 • ‎日本語
Profiling: $wgProfiler
Settings related to profiling.
Introduced in version:1.8.0
Removed in version:still in use
Allowed values:associative array
Default value:array()[1]
Other settings: Alphabetical | By function

Details[edit]

This setting is used to configure profiling of your MediaWiki installation.

See the StartProfiler.sample file, located in the root of your MediaWiki installation, for more information.

For the available keys see Manual:Profiling . They include:

'class'
E.g. ProfilerXhprof provides an Xhprof-backed profiler.
'output'
Define one or multiple output methods. For multiple output methods at the same time, use an array of class names, one for each output type you want the profiler to generate. For example use the "ProfilerOutputText" profiler. The output classes available to you by default are ProfilerOutputDb, ProfilerOutputDump, ProfilerOutputStats, ProfilerOutputText, and ProfilerOutputUdp.
  • ProfilerOutputStats outputs profiling data as StatsD metrics. It expects that you have set the $wgStatsdServer configuration variable to the host (or host:port) of your statsd server.
  • ProfilerOutputText will output profiling data in the page body as a comment. You can make the profiling data in HTML render as part of the page content by setting the 'visible' configuration flag: $wgProfiler['visible'] = true;
  • ProfilerOutputDb expects a database table that can be created by applying maintenance/archives/patch-profiling.sql to your database.
  • ProfilerOutputDump expects a $wgProfiler['outputDir'] telling it where to write dump files. The files produced are compatible with the XHProf gui.
'visible'
true or false. If true, output is displayed in HTML rendering (and not only in a comment).
'sampling'
Positive integer. Profile every nth request.
'flags'
...
'include'
...
'exclude'
...
'udphost'
Hostname of the UDP server which receives ????????????????? what ?????
Supersedes $wgUDPProfilerHost.
'udpport'
Port of the UDP server which receives ????????????????? what ?????
Supersedes $wgUDPProfilerPort.
'udpformat'
Format string to use for ????????????????? what ?????
Supersedes $wgUDPProfilerFormatString.
'perhost'
Should the application server hostname be stored in the profiling table?
Supersedes $wgProfilePerHost.

For performance, the profiler is always disabled for CLI scripts as they could be long running and the data would accumulate. Use the '--profiler' parameter of maintenance scripts to override this.

Example[edit]

For a rudimentary sampling profiler:

$wgProfiler['class'] = 'ProfilerXhprof';
$wgProfiler['output'] = array( 'ProfilerOutputDb' );
$wgProfiler['sampling'] = 50;
// one every 50 requests

This will use ProfilerStub for non-sampled cases.

See also[edit]

  • Set in includes/WebStart.php