Using xdebug to profile php code is very simple.
Following are the steps to get started:
1) Install the xdebug extension (http://xdebug.org/docs/install) for PHP.
2) Enable profiling for any PHP which gets executed by setting xdebug.profiler_enable=1 in php.ini
3) Restart the Apache Server
From now on, whenever you execute a PHP, files with name starting from cachegrind.out will be created under the /tmp directory.
4) Install kcachegrind (http://kcachegrind.sourceforge.net/)
5) start kcachegrind with the cachegrind.out file as the parameter (eg. kcachegrind cachegrind.out.12345)
6) Set xdebug.profiler_enable=0 in php.ini to disable profiling.
No comments:
Post a Comment