PHP Performance Analysis Tool

Source: Internet
Author: User
XHProf is a function-level PHP layered analyzer developed by FaceBook. The data collection part is a C-based PHP extension, and the analysis report is a series of PHP-based HTML navigation pages. XHProf can count the number of calls to each function, memory usage, CPU usage, and other important data. In addition, XHProf can compare two statistical samples.

XHProf is a function-level PHP layered analyzer developed by FaceBook. The data collection part is a C-based PHP extension, and the analysis report is a series of PHP-based HTML navigation pages. XHProf can count the number of calls to each function, memory usage, CPU usage, and other important data. In addition, XHProf can compare two statistical samples.

XHProf is a function-level PHP layered analyzer developed by FaceBook.

The data collection part is a C-based PHP extension, and the analysis report is a series of PHP-based HTML navigation pages.

XHProf can count the number of calls to each function, memory usage, CPU usage, and other important data.

In addition, XHProf can compare two statistical samples or summarize the results from multiple data samples.

XHProf is a powerful tool for analyzing the execution efficiency of PHP programs, so that we can get more underlying analysis data.


Compile and install

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

Configure php. ini

Add in 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: For a 64-bit system, copy the xhprof. so file to the related lib64 directory.

Add the code to the php to be tested

1
 Save_run ($ data, "xhprof"); 21 var_dump ($ run_id );

View running results

Copy the xhprof_lib & xhprof_html directory to the accessible address to access xxx/xhprof_html/index. php? Run = $ run_id & source = bluefrog. 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

Note:You need to use the ctype extension.



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.