Skip to content
PHP7 support
Branch: master
Clone or download
Pull request Compare This branch is 54 commits ahead of phacility:master.
Latest commit 0d6c4eb Mar 27, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Add a failing test case for the XHProf PHP 5.5 segfault Aug 28, 2014
examples initial version 0.9.0 from source Mar 17, 2009
extension add collect additional info option Mar 27, 2019
scripts Add a failing test case for the XHProf PHP 5.5 segfault Aug 28, 2014
support/libxhprof Add a basic `arc unit` test binding to XHProf Aug 28, 2014
travis fix travis Feb 16, 2019
xhprof_html XHProf: add .arclint, fix some minor issues Aug 28, 2014
xhprof_lib 修复php7不兼容create_function Mar 14, 2019
.arcconfig Add a basic `arc unit` test binding to XHProf Aug 28, 2014
.arclint XHProf: add .arclint, fix some minor issues Aug 28, 2014
.gitignore Add a basic `arc unit` test binding to XHProf Aug 28, 2014
.travis.yml Update .travis.yml Feb 16, 2019
CHANGELOG add support to ignore specified functions during profiling; more tests May 27, 2009
CREDITS Update .arcconfig and acknowledge that we're the new maintainers in X… Aug 27, 2014
LICENSE XHProf: add .arclint, fix some minor issues Aug 28, 2014
README.md Update README.md Mar 27, 2019
package.xml

README.md

xhprof for PHP7

Build Status

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based navigational interface. The raw data collection component is implemented in C (as a PHP extension). The reporting/UI layer is all in PHP. It is capable of reporting function-level inclusive and exclusive wall times, memory usage, CPU times and number of calls for each function. Additionally, it supports ability to compare two runs (hierarchical DIFF reports), or aggregate results from multiple runs.

This version supports PHP7

PHP Version

  • 7.0
  • 7.1
  • 7.2
  • 7.3

Installation

git clone https://github.com/longxinH/xhprof.git ./xhprof
cd xhprof/extension/
/path/to/php7/bin/phpize
./configure --with-php-config=/path/to/php7/bin/php-config
make && sudo make install

configuration add to your php.ini

[xhprof]
extension = xhprof.so
xhprof.output_dir = /tmp/xhprof

php.ini configuration

    Options       Defaults Version Explain
xhprof.output_dir   "" All Output directory
xhprof.sampling_interval   100000 >= v2.* Sampling interval to be used by the sampling profiler, in microseconds
xhprof.sampling_depth   INT_MAX >= v2.* Depth to trace call-chain by the sampling profiler
xhprof.collect_additional_info   0 >= v2.1 Collect mysql_query, curl_exec internal info. The default is 0. Open value is 1

Turn on extra collection

PDO::exec

PDO::query

mysqli_query

$mysqli = new mysqli("localhost", "my_user", "my_password", "user");
$result = $mysqli->query("SELECT * FROM user LIMIT 10");
Output data
mysqli::query#SELECT * FROM user LIMIT 10

PDO::prepare

Convert preprocessing placeholders for actual parameters, more intuitive analytic performance (does not change the zend execution process)

$_sth = $db->prepare("SELECT * FROM user where userid = :id and username = :name");
$_sth->execute([':id' => '1', ':name' => 'admin']);
$data1 = $_sth->fetch();

$_sth = $db->prepare("SELECT * FROM user where userid = ?");
$_sth->execute([1]);
$data2 = $_sth->fetch();
Output data
PDOStatement::execute#SELECT * FROM user where userid = 1 and username = admin
PDOStatement::execute#SELECT * FROM user where userid = 1

Curl

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.baidu.com");
$output = curl_exec($ch);
curl_close($ch);
Output data
curl_exec#http://www.baidu.com
You can’t perform that action at this time.