Manual:Profiling/Xhprof

Starting with MediaWiki 1.25, you can use xhprof to profile code. You can install the pecl package or see if your distribution has a package for xhprof. HHVM has xhprof built in.

TODO Document:
 * Scoped sub-section profiling
 * Links to upstream bugs

Installing
HHVM has xhprof built-in. For PHP5 (Zend) users:


 * Use the php5-xhprof package provided by your system's package manager
 * Download the source from pecl and build manually

Configuration
An example StartProfiler.php file:

When enabled,  unconditionally calls , and will cause a fatal error if xhprof is not installed.

In addition to the normal  options,   supports these settings:
 * Flags to pass to  (e.g. XHPROF_FLAGS_NO_BUILTINS, XHPROF_FLAGS_CPU, XHPROF_FLAGS_MEMORY). See the [//php.net/xhprof xhprof] documentation for more details.
 * Flags to pass to  (e.g. XHPROF_FLAGS_NO_BUILTINS, XHPROF_FLAGS_CPU, XHPROF_FLAGS_MEMORY). See the [//php.net/xhprof xhprof] documentation for more details.


 * Array of function names to exclude from the profiler data collection and reports.
 * Note: HHVM's implementation of xhprof does not currently respect this setting.
 * Note: HHVM's implementation of xhprof does not currently respect this setting.


 * Array of function names to include in profiling.
 * The data collected by xhprof is filtered to show only edges involving the given functions when generating reports.
 * The data collected by xhprof is filtered to show only edges involving the given functions when generating reports.