All Projects → longxinH → xhprof

longxinH / xhprof

Licence: Apache-2.0 license
PHP7/PHP8 support

Projects that are alternatives of or similar to xhprof

V8js
V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
Stars: ✭ 1,659 (+89.17%)
Mutual labels:  php-extension
nanobox-engine-php
Engine for running PHP apps on Nanobox
Stars: ✭ 20 (-97.72%)
Mutual labels:  php-extension
php-to-zephir
Convert PHP 7 files to Zephir zep files and create a native PHP extension
Stars: ✭ 25 (-97.15%)
Mutual labels:  php-extension
Php Zephir Parser
The Zephir Parser delivered as a C extension for the PHP language.
Stars: ✭ 129 (-85.29%)
Mutual labels:  php-extension
Php V8
PHP extension for V8 JavaScript engine
Stars: ✭ 197 (-77.54%)
Mutual labels:  php-extension
php-smartcrop-extension
smartcrop implementation in php extension
Stars: ✭ 17 (-98.06%)
Mutual labels:  php-extension
Php Akm
Ahocorasick keyword match.
Stars: ✭ 116 (-86.77%)
Mutual labels:  php-extension
skeleton-php-ext
Skeleton project for PHP extension (written in C)
Stars: ✭ 24 (-97.26%)
Mutual labels:  php-extension
xray
X-Ray - PHP Engine compiler hook API (new)
Stars: ✭ 19 (-97.83%)
Mutual labels:  php-extension
pdo sqlcipher
SQLCipher PDO (PHP Data Objects) driver
Stars: ✭ 17 (-98.06%)
Mutual labels:  php-extension
Ycdatabase
The lightest php database framework written in c language, built in php extension, for mysql
Stars: ✭ 130 (-85.18%)
Mutual labels:  php-extension
Php Psr
PHP extension providing the accepted PSR interfaces
Stars: ✭ 189 (-78.45%)
Mutual labels:  php-extension
php-mustache
Mustache PHP Extension
Stars: ✭ 55 (-93.73%)
Mutual labels:  php-extension
Cphalcon
High performance, full-stack PHP framework delivered as a C extension.
Stars: ✭ 10,534 (+1101.14%)
Mutual labels:  php-extension
zephir-docs
Zephir Documentation and website
Stars: ✭ 62 (-92.93%)
Mutual labels:  php-extension
Php Rdkafka
Production-ready, stable Kafka client for PHP
Stars: ✭ 1,703 (+94.18%)
Mutual labels:  php-extension
php-bencode
C++ PHP extension which can boost the process of encoding and decoding of Bencode.
Stars: ✭ 16 (-98.18%)
Mutual labels:  php-extension
learn-computer
PHP函数源码分析、计算机相关知识
Stars: ✭ 13 (-98.52%)
Mutual labels:  php-extension
Tensor
A library and extension that provides objects for scientific computing in PHP.
Stars: ✭ 146 (-83.35%)
Mutual labels:  php-extension
php-document-creator
a document creator for php extension.一个用于生成PHP扩展文档的工具
Stars: ✭ 25 (-97.15%)
Mutual labels:  php-extension

xhprof for PHP7 and PHP8

Build Status 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 and PHP8

PHP Version

  • 7.2
  • 7.3
  • 7.4
  • 8.0
  • 8.1
  • 8.2

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

php.ini adds xhprof.collect_additional_info

xhprof.collect_additional_info = 1

Options

xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);
  • XHPROF_FLAGS_NO_BUILTINS do not profile builtins
  • XHPROF_FLAGS_CPU gather CPU times for funcs
  • XHPROF_FLAGS_MEMORY gather memory usage for funcs

Example

<?php

array(
    "main()" => array(
        "wt" => 237,
        "ct" => 1,
        "cpu" => 100,
    )
)
  • wt The execution time of the function method is time consuming
  • ct The number of times the function was called
  • cpu The CPU time consumed by the function method execution
  • mu Memory used by function methods. The call is zend_memory_usage to get the memory usage
  • pmu Peak memory used by the function method. The call is zend_memory_peak_usage to get the memory

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

PECL Repository

pecl

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].