PHP Performance analysis tool xhprof installation using tutorials, XHPROF installation using
Hprof is an open source PHP lightweight performance analysis tool for Facebook, similar to Xdebug, but with lower performance overhead, can also be used in production environments or controlled by program switches. Based on Browse
The Performance analysis user interface of the device is easier to view or share results with peers. The call graph can also be drawn. During the data collection phase, it records the number of calls to trace and the inclusive indicator arcs in a dynamic CallGraph program.
It is unique to the reporting/post-processing phase of the data calculation. At data collection, XHPROFD handles recursive function calls by detecting loops and avoids the dead loop by invoking a useful name for each depth in the recursive call.
Xhprof's lightweight nature and aggregation capabilities make it ideal for collecting statistics on performance statistics for "production environments".
1. Installing Xhprof
Copy the Code code as follows:
wget http://pecl.php.net/get/xhprof-0.9.2.tgz
Tar zxf xhprof-0.9.2.tgz
CD xhprof-0.9.2
Cp-r xhprof_html Xhprof_lib
CD extension
Phpize
./configure
Make
Make install
2. Configuring the php.ini File
Copy the Code code as follows:
[Xhprof]
Extension=xhprof.so
;
; Directory used by default implementation of the Ixhprofruns
; Interface (namely, the Xhprofruns_default Class) for storing
; Xhprof runs.
; Remember that the Web has write permissions
Xhprof.output_dir=
Restart the service for the changes to take effect, you can now use Xhprof, but in order to show more dazzling, it is best to continue to install Graphviz.
3. Installing Graphviz
Copy the Code code as follows:
wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.3.tar.gz
Tar zxf graphviz-2.26.3.tar.gz
CD graphviz-2.26.3
./configure
Make
Make install
After the installation is complete, the/usr/local/bin/dot file is generated and you should make sure that the path is in the PATH environment variable so that xhprof can find it.
4. Application Xhprof
Copy the Code code as follows:
Xhprof_enable ();//Open Xhprof
/****** program Logic start******/
function Test1 () {
Sleep (3);
Return
}
function Test2 () {
Test1 ();
}
function Test3 () {
Test2 ();
}
function P () {
Echo '
Xhprof Test
';
}
P ();
Test3 ();
/****** program Logic end******/
$xhprof _data = xhprof_disable ();//Close Xhprof
Saving Xhprof Data
Include_once '. /xhprof_lib/utils/xhprof_lib.php ';
Include_once '. /xhprof_lib/utils/xhprof_runs.php ';
$xhprof _runs = new Xhprofruns_default ();
$xhprof _source = ' xhprof_test ';
$run _id = $xhprof _runs->save_run ($xhprof _data, $xhprof _source);
$report _url = ' http://xhprof.rebill.info/index.php?run= '. $run _id. ' &source= '. $xhprof _source;
Echo '
';
Echo ' View the performance report: '. $report _url. ';
In this way, a data file with a name similar to 4c236583ef490.xhprof_test will be generated in the Xhprof.output_dir directory set above, which can be easily browsed through the Web:
Http://xhprof.rebill.info/index.php?run=4c236583ef490&source=xhprof_test
Currently displayed in tabular form, click on [View full CallGraph] on the page to see the beautiful picture displayed.
Online Test experience Address: http://xhprof.rebill.info/test.php
http://www.bkjia.com/PHPjc/998808.html www.bkjia.com true http://www.bkjia.com/PHPjc/998808.html techarticle PHP Performance analysis tool xhprof installation using the tutorial, xhprof installation using Hprof is a PHP lightweight performance analysis tool that is open to Facebook, similar to Xdebug, but with lower performance overhead ...