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.