PHPackages                             totara/xhprof - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. totara/xhprof

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

totara/xhprof
=============

Fork of XHProf for Totara

2.3.10.4(8mo ago)05.8k↓13.3%2Apache-2.0PHPPHP &gt;=8.2.0

Since Sep 15Pushed 8mo agoCompare

[ Source](https://github.com/totara/xhprof)[ Packagist](https://packagist.org/packages/totara/xhprof)[ RSS](/packages/totara-xhprof/feed)WikiDiscussions totara Synced 1mo ago

READMEChangelog (5)DependenciesVersions (10)Used By (0)

xhprof
======

[](#xhprof)

This is a fork specifically for Totara projects.

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 PHP8 and supports Totara 20 onwards only.

PHP Version
===========

[](#php-version)

- 8.2

Installation
============

[](#installation)

```
git clone https://github.com/totara/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

[](#configuration-add-to-your-phpini)

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

```

### php.ini configuration

[](#phpini-configuration)

 Options DefaultsVersionExplainxhprof.output\_dir ""AllOutput directoryxhprof.sampling\_interval 100000&gt;= v2.\*Sampling interval to be used by the sampling profiler, in microsecondsxhprof.sampling\_depth INT\_MAX&gt;= v2.\*Depth to trace call-chain by the sampling profilerxhprof.collect\_additional\_info 0&gt;= v2.1Collect mysql\_query, curl\_exec internal info. The default is 0. Open value is 1Turn on extra collection
========================

[](#turn-on-extra-collection)

#### php.ini adds xhprof.collect\_additional\_info

[](#phpini-adds-xhprofcollect_additional_info)

```
xhprof.collect_additional_info = 1
```

Options
=======

[](#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

```
