Summary of Xhprofphp performance testing tools

Source: Internet
Author: User
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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.