手册:$wgProfiler

本頁使用了標題或全文手工轉換
From mediawiki.org
This page is a translated version of the page Manual:$wgProfiler and the translation is 21% complete.
性能分析: $wgProfiler
Settings related to profiling.
引进版本:1.8.0
移除版本:仍在使用
允许的值:(关联数组)
默认值:[]

详情

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

For the available keys see 手册:剖析 . 它们包含:

'class'
E.g. ProfilerXhprof provides an Xhprof-backed profiler. There is also ProfilerExcimer which works with Excimer .
'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: ProfilerOutputDump, ProfilerOutputStats, ProfilerOutputText.
  • 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;

  • 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.

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.

示例

For a rudimentary debug profiler:

$wgProfiler= [
  'class' => ProfilerXhprof::class,
  'output' => ProfilerOutputText::class,
];

参见