MateoWartelle / xhprof

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.

Home Page:http://pecl.php.net/package/xhprof

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maintained xhprof for PHP 7.0, 7.1, 7.2, 7.3, 8.0, 8.1

Install

Compile in Linux

$ cd extension/
$ phpize
$ ./configure [--with-php-config=/path/to/php-config]
$ make && make install

edit php.ini, add a new line:

extension=xhprof.so

make sure it works:

php -m |grep xhprof

Profile your page

Add the following, as early as possible, to your initial PHP script:

xhprof_enable();

register_shutdown_function(
    function () {
        file_put_contents("/tmp/" . uniqid() . ".ApplicationName.xhprof", serialize(xhprof_disable()));
    }
);

Look at the results:

Make sure xhprof_html directory is reachable from your web application and reach the page xhprof_html/index.php to see a list of profiles.

About

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.

http://pecl.php.net/package/xhprof

License:Apache License 2.0


Languages

Language:PHP 50.7%Language:HTML 23.1%Language:JavaScript 14.5%Language:C 10.2%Language:CSS 1.4%Language:M4 0.1%