Manual:Profiling/ja

プロファイリングは、ページ操作中のコード実行を追跡し、特定の機能に費やされたコード実行が全体に占める割合を報告します. Profiling is an advanced task intended for developers and system administrators to track sources of slowness in MediaWiki that should be optimized.



PHP プロファイリング
You can use Tideways or XDebug. These PHP extensions provide tracing and profiling capabilities.

Tideways also advertises a proprietary UI to visualize results, but you don't need that.

Install the  package on Debian/Ubuntu, or Homebrew on macOS.

For XDebug, see XDebug profiling documentation. For command line scripts, you can use. Webgrind can then be used to view profile results.



MediaWiki カスタム プロファイラー
In MediaWiki 1.25 profiling was completely rewritten and many settings previous relating to profiling were removed in favor of consolidating them as parameters to $wgProfiler. Notably, output has been separated from class types. For documentation about profiling prior to 1.25, see an older version of this page.

Example configuration:

Each of these parameters (and more) are described in detail:


 * class
 * 'ProfilerXhprof'. ProfilerXhprof is new in MediaWiki 1.25 and provides an Xhprof-backed profiler that captures profiling data for all functions as well as sub-functional units. Old values such as ProfilerStandard, ProfilerUDP, ProfilerDB, etc do not work. Even if you are using Tideways, still specify the ProfilerXhprof class.


 * output
 * One or more of 'ProfilerOutputText', 'ProfilerOutputDump', 'ProfilerOutputStats' . Text outputs the information in either HTML comments or after the skin. UDP is a format send to a udpprofile daemon. Dump produces a dump of the profiling info for use with xhprof GUI (xhprofgui role on Vagrant setup).


 * outputDir
 * Only applies to 'ProfilerOutputDump' format. Required to specify where the dump files will be stored.


 * visible
 * Only applies to 'ProfilerOutputText' format. Whether text is shown after the skin or in an HTML comment.

Troubleshooting
If you get "Fatal error: Uncaught Exception: Neither xhprof nor tideways are installed" then you need to do:

If you still get an error, then take a look at https://tideways.com/profiler/xhprof-for-php7

出力
テキストをこのように出力します

The first column is the time percent; the second column is the time (in ms); the third column is the count; and the fourth column is the name of the method.

