Summary of Xhprofphp Performance Testing Tool Usage & nbsp; xhprof is a lightweight php performance analysis tool launched by facebook. compared with Xdebug, XH Xhprof php performance testing tool usage summary
Xhprof is a lightweight php performance analysis tool launched by facebook. compared with Xdebug, XHProf is easier to use and controllable, especially when generating flowcharts and debugging data. The following describes how to install and use Xhprof.
1. Installation
You can download the corresponding version from the page and learn about the dependency conditions of each version. Before installation, assume that the php bin directory is/usr/local/php/bin.
[root@localhost extension]# ln -s /usr/local/php/bin/phpize /usr/bin/phpize[root@localhost tool]# wget http://pecl.php.net/get/xhprof-0.9.2.tgz[root@localhost tool]# tar -zxvf xhprof-0.9.2.tgz [root@localhost tool]# cd xhprof-0.9.2/extension/[root@localhost tool]# ./configure --with-php-config=/usr/local/php/bin/php-config[root@localhost tool]# make[root@localhost tool]# make install
Through the above operation, if luck is not very bad, you should see a prompt like this: Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
Go to the php Extension Library Directory/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/and you will see the xhprof. so shared library file.
2. configuration
In the php. ini file, add the following configuration:
[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
Restart php to use xhprof.
3. copy an object
Copy all the files under xhprof_html and xhprof_lib in the xhprof-0.9.2 directory to the home directory of your website. assume that the home directory of your website is/opt/wordpress.
[root@localhost xhprof-0.9.2]# cp -R xhprof_* /opt/wordpress
4. use
Refer to the following explanations:
Save_run ($ data, "xhprof "); // view the running result url // The run value comes from the return value of save_run // The source value comes from the second parameter of save_run // www.abc.com needs to replace echo "http://www.abc.com/xhprof_html/index.php? Run = ". $ run_id." & source = xhprof ";
Open the output url in the browser and view the relevant performance information.