Background
The Profiler in MediaWiki core (owned by MPT per mw:Maintainers) is what powers collecting the call graph and memory usage during a request to ease local development (https://www.mediawiki.org/wiki/Manual:Profiling), and in production via WikimediaDebug (https://wikitech.wikimedia.org/wiki/WikimediaDebug#XHGui_profiling).
It has been stable for 10 years and is unlikely to need changes, so this task is mainly to ensure it works on PHP 8.3, and by proxy of testing that, this task is about sharing knowledge inside the platform about how other MW developers use/depend on this, and for team members that haven't used it before, to be famliair with how to install and use it locally.
This task
MediaWiki core supports php-xhprof 0.9 and its fork php-tideways-xhprof. The current version of php-xhprof is 2.x, which we have not tested before. As part of the PHP 8.1 to PHP 8.3 upgrade, we will be switching from the abandoned php-tideways-xhprof package to the php-xhprof 2.x package. I wrote more details and reasons for this package choice at T398245#10965108.
This task represents the MwEng support part of Prep for WMF / 1. Create Debian packages step in the new process (https://wikitech.wikimedia.org/wiki/User:Krinkle/PHP_Upgrade_Process), which is being carried out by SRE in the parent task as part of FY2-26 WE6.4.2: PHP 8.3 upgrade.
Scope
- Understand and verify status quo
- On your local dev env with PHP 8.1 and tideways_xhprof, play with $wgProfiler in LocalSettings.php. Documentation: https://www.mediawiki.org/wiki/Manual:Profiling.
- Generate the "text" output on a page view, which should print a list of function call counts and percentage time spent in an HTML comment
- Generate the "text" output via a CLI maintenance script.
- Switch your local dev temporarily to php8.4 and install xhprof from PECL (probably easiest with Quickstart, as opposed to Docker-based dev envs).
- Generate the same outputs. Or if not working, investigate the upstream changelog, and update the ProfilerXhrof subclass as-needed to ensure it is compatible and outputs the same data as before.
- Update https://www.mediawiki.org/wiki/Manual:Profiling as-needed with any findings about how to install, enable, and use the feature. In particular, we will now be recommending php-xhprof instead of php-tideways-xhprof, because Tideways has indicated they no longer maintain this (https://github.com/tideways/php-xhprof-extension/).