Xhprof is an open source PHP lightweight performance analysis tool for Facebook, similar to Xdebug, but with lower performance overhead, can also be used in production environments or controlled by program switches. Overall is a good tool, the following is introduced under Ubuntu under the installation and use of the process.
Install Xhprof:
wget http://pecl.php.net/get/xhprof-0.9.2.tgztar zxf xhprof-0.9.2.tgzcd xhprof-0.9.2/extension/sudo phpize./ Configure--with-php-config=/usr/local/php/bin/php-configsudo Makesudo make install
In order to view the debug results graphically, you must also install the Graphviz tool, under Ubuntu you can directly use the Apt-get way to install, command: sudo apt-get install Graphviz, if it is other systems, it has to Zigzag point, The command is as follows:
wget http:< span="">< span="">tar zxf graphviz-< span="">. < span="">< span="">-< span="">. /&&< span="">make install < span=""> < span="">
Configure PHP.ini
Add the following to the php.ini:
[Xhprof]
extension=xhprof.so;
; Directory used by default implementation of the Ixhprofruns
; Interface (namely, the Xhprofruns_default Class) for storing
; Xhprof runs.
;
; xhprof.output_dir=
Xhprof.output_dir=/tmp/xhprof
Note: If the 64-bit system needs to copy the xhprof.so file to the relevant Lib directory (LIB64)
After the change to restart the next Apache, look at the phpinfo, there should be xhprof information about it.
Add the code to the PHP you want to test
Save_run ($data, "xhprof"); Var_dump ($run _id); View Run results
Copy the xhprof_lib&&xhprof_html related directory to the address you can access
Visit xxx/xhprof_html/index.php?run= $run _id can see your PHP code to run the situation, where $run_id is the output of the above page, remember must include
Xhprof_lib under the two files, if you do not want to pass this way can also directly output the relevant printing information, that is, directly print_r the above $data value.
http://www.bkjia.com/PHPjc/748243.html www.bkjia.com true http://www.bkjia.com/PHPjc/748243.html techarticle Xhprof is an open source PHP lightweight performance analysis tool for Facebook, similar to Xdebug, but with lower performance overhead, can also be used in production environments or controlled by program switches ...