How to install and use the PHP function-level hierarchical performance analysis tool xhprof 1. download and install xhprof
$ wget http://pecl.php.net/get/xhprof-0.9.4.tgz$ tar zxvf xhprof-0.9.4.tgz$ cd xhprof-0.9.4/extension/$ phpize$ ./configure $ make$ sudo make install
2. configure php. ini
[xhprof]extension=xhprof.so;xhprof.output_dir=/tmp/xhprof
Restart php-fpm
$ service php-fpm restart
3. usage
Save_run ($ data, "xhprof"); var_dump ($ run_id );
4. page display instructions
Copy the xhprof_lib & xhprof_html directory to the accessible address to access xxx/xhprof_html/index. php? Run = $ run_id & source = xhprof. you can see the running status of your php code. The following describes some parameters that indicate that the random Time includes all the execution Time of the sub-function. Exclusive Time/Self Time: the Time consumed by the function execution, excluding the Time consumed by the subtree. The Time that Wall Time took or the Time when the Wall clock was suspended. CPU Time user consumed Time + kernel consumed Time: CPU occupied by the CPU exclusive function itself, including the CPU occupied by the CPU used by the sub-function