pear upgrade PEAR
pecl install xhprof-0.9.2
If you're on mamp:
- Feel shame
- Try getting the compiled extensions here: https://github.com/cam8001/php-xhprof-mamp
git clone git://github.com/facebook/xhprof.git
cd xhprof/extension
phpize
./configure
make
cp modules/xhprof.so $(php-config --extension-dir)/
<?php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(function() {
$xhprof_data = xhprof_disable();
$namespace = 'sitename';
$filename = '/tmp/' . uniqid() . '.' . $namespace . '.xhprof';
file_put_contents($filename, serialize($xhprof_data));
});
Load the site, and you should now see some .xhprof files in /tmp. These can be viewed with a single page version of the original UI found here: