Manual:Profiling

To get more detail, you need to enable profiling. Profiling tracks code execution during a page action and reports back the percentage of total code execution that was spent in any specific function. Profiling is an advanced task intended for developers and system administrators to track sources of slowness in MediaWiki that should be optimized.

MediaWiki profiling is configured in StartProfiler.php in the root of your wiki. There's a StartProfiler.sample file there to get you started as well.

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.

Here is a typical StartProfiler.php:

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.


 * output
 * One or more of 'udp', 'text', 'db'. Text outputs the information in either HTML comments or after the skin. DB requires the profiling table to be created and stores data on individual profiling runs. UDP is a format send to a udpprofile daemon.


 * perHost
 * Only applies to 'db' format. Whether to store host information with profiling runs.


 * udphost
 * Only applies to 'udp' format. Host/IP to send data to.


 * udpport
 * Only applies to 'udp' format. Port to send data to.


 * udpformat
 * Only applies to 'udp' format. Format string to use. Can usually be left alone.


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