XHProf is a profiler that can measure processing time for each function called to render a page.
Installation on lando
.lando.yml
services:
config:
php: config/php.ini
appserver:
build_as_root:
- apt update
- apt install -y graphviz
- pecl install xhprof
- docker-php-ext-enable /usr/local/lib/php/extensions/no-debug-non-zts-20210902/xhprof.soFor info on the docker-php-ext-enable command, see https://hub.docker.com/_/php/.
config/php.ini
xhprof.output_dir = /app/xhprofXHProf module
View XHProf on Drupal.orgXHProf
Install, enable and configure xhprof as the profiler.
View reports.
Callgraph
View the function call graph, rendered with graphviz.
This patch is needed: View on Drupal.org #1470740Callgraph support Status: Needs review
Since Drupal can go through many php files, the callgraph is often too big to comprehend.
Activate the profiler manually, around the code you want to profile.
xhprof_enable();
test_function();
$data = xhprof_disable();
file_put_contents('/app/xhprof/output.html', $data);PHP Profiler module
View XHGui PHP Profiler on Drupal.orgXHGui PHP Profiler
TODO.
Modules
Resources