Home  >  Article  >  Backend Development  >  PHP performance testing tool Xhprof

PHP performance testing tool Xhprof

不言
不言Original
2018-05-08 09:10:581886browse

This article mainly introduces Xhprof, a PHP performance testing tool, which has a certain reference value. Now I share it with everyone. Friends in need can refer to it

Xhprof is a PHP performance testing tool. The extension can only be installed under Linux environment.

First installation steps

Download the source code package of xhprof from the official website http://pecl.php.net/package/xhprof
tar -zxvf xhprof-0.9.4.tgz
cd xhprof-0.9.4
cd extensions
./configure --with-php-config=/usr/local/data/php/bin/php-config //Note here is your own php path
make
sudo make install
Modify php.ini
extension=xhprof.so
xhprof.output_dir="/vagrant_data/xhprof"
#Restart php-fpm
ps aux | grep php-fpm
Find the master process
kill -USR2 process number

Check whether phpinfo is successful


OK , after seeing it, it means that the installation has been successful. Next, do a test to see the effect.

The decompressed compressed package contains two folders, xhprof_html and xhprof_lib, which are used to display test results:


Then visit Just sample.php under the examples folder: 127.0.0.1/examples/sample.php.

Then visit 127.0.0.1/xhprof_html/index.php



##Click to transfer




The analysis results have been displayed on the interface, click [View Full Callgraph] to display An analysis picture

Requires installation

yum install graphviz


After installation, click to view the picture


Displayed in the form of pictures. This result is because the test is relatively simple, but in actual development the results will be many and complex.

This kind of interface is not very friendly, I will study xhprof gui in the future

Related recommendations:

Detailed explanation of the installation and use of the PHP performance testing tool xhprof


The above is the detailed content of PHP performance testing tool Xhprof. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn