: This article describes how to install xhprof on ubuntu. For more information about PHP tutorials, see. 1. Installation
Wget-c http://pecl.php.net/get/xhprof-0.9.2.tgztar-xzvf. /xhprof-0.9.2.tgzcp. /xhprof-0.9.2.tgz. /www // xhprof itself has a web analysis page, which is placed under my web server cd. /xhprof-0.9.2/extension/usr/local/php/bin/phpize. /configure -- enable-xhprof -- with-php-config =/usr/local/php/bin/php-configmake & make install
[Xhprof] extension = xhprof. soxhprof. output_dir =/data/xhprof // if the directory is not added, it will be placed under/tmp by default (note: You must have the write permission, directly 777 )!
service apache2 restart
// Start xhprofxhprof_enable (XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); various awesome code ....... // Stop xhprof $ xhprof_data = xhprof_disable (); $ XHPROF_ROOT = realpath (dirname (_ FILE __). '/.. '); include_once $ XHPROF_ROOT. "/xhprof_lib/utils/xhprof_lib.php"; include_once $ XHPROF_ROOT. "/xhprof_lib/utils/logs"; // save statistics and generate the statistics ID and source name $ xhprof_runs = new XHProfRuns_Default (); $ run_id = $ xhprof_runs-> save_run ($ xhprof_data, "xhprof_foo"); // The source name is xhprof_foo // view the statistics echo". $ Run_id. "& source = xhprof_foo 'target = '_ blank'> XHProf view
";
2. display results
Displays the call status of each function in tabular form and image.
Such fields in the table
Column name description
Function Name.
The number of times the CILS method is called.
Call% percentage of call times of methods in the total number of Calls of the same level.
The Time taken to execute the Incl. Wall Time (microsec) method, including the execution Time of sub-methods. (Unit: microseconds)
IWall % percentage of time spent on method execution.
Excl. Wall Time (microsec) method execution Time, excluding the execution Time of sub-methods. (Unit: microseconds)
EWall % percentage of time consumed by method execution.
The CPU time consumed by the Incl. CPU (microsecs) method, including the execution time of sub-methods. (Unit: microseconds)
ICpu % Percentage of CPU time spent on method execution.
The CPU time consumed by the Excl. CPU (microsec) method, excluding the execution time of sub-methods. (Unit: microseconds)
ECPU % Percentage of CPU time consumed by the method itself.
Memory occupied by Incl. MemUse (bytes) method execution, including the memory occupied by sub-method execution. (Unit: bytes)
IMemUse % Percentage of memory occupied by method execution.
Excl. MemUse (bytes) method memory occupied by execution, excluding the memory occupied by sub-method execution. (Unit: bytes)
EMemUse % Percentage of memory occupied by method execution.
Incl. PeakMemUse (bytes) Incl. MemUse peak value. (Unit: bytes)
IPeakMemUse % Incl. MemUse peak percentage.
Excl. PeakMemUse (bytes) Excl. MemUse peak value. Unit: (bytes)
EPeakMemUse % Excl. MemUse peak percentage.
For images, you need to install libpng and graphviz.
Install libpng
wget -c http://sourceforge.net/projects/libpng/files/libpng15/1.5.23beta01/libpng-1.5.23beta01.tar.gz/downloadtar -xzvf ./libpng-1.5.23beta01.tar.gzcd ./libpng-1.5.23beta01./configuremake && make install
Install graphviz
wget -c http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.24.0.tar.gztar -xzvf ./graphviz-2.24.0.tar.gzcd ./graphviz-2.24.0./configuremake && make install
After installation, restart apache.
Service apache2 restart
On the table page, click [View Full Callgraph].
The call performance of each code segment can be displayed as an image.
The above section describes how to install xhprof in ubuntu, including some content. I hope my friends who are interested in the PHP Tutorial can help me.