When developing some functional modules with relatively high efficiency requirements, it is often necessary to analyze the running bottlenecks of the program. Use the following tool to easily view the PHP script execution process. The following are the configuration steps:
1. PHP installation -debug-non-zts-20100525/xdebug.so
xdebug.profiler_output_dir="/mnt/hgfs/web/log/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_autostart = On
mote_handler="dbgp"
xdebug .remote_mode=req
After this configuration, the performance debugging file will not be generated when the php program is executed normally. The debugging file will be generated only by adding the url parameter XDEBUG_PROFILE=1 to the suffix of the url. The debug file is in the path configured by the xdebug.profiler_output_dir parameter.
2. Install the tool qcachegrind to parse the debugging file
Download address: http://sourceforge.net/projects/qcachegrindwin/
Open qcachegrind, select the debugging file generated previously to open it and view it.
Actually, there are several tools of this type. This one is the one I have used and found to be more straightforward.