xhprof_enable

(PECL xhprof >= 0.9.0)

xhprof_enableStart xhprof profiler

Description

xhprof_enable(int $flags = 0, array $options = ?): void

Start xhprof profiling.

Parameters

flags

Optional flags to add additional information to the profiling. See the XHprof constants for further information about these flags, e.g., XHPROF_FLAGS_MEMORY to enable memory profiling.

options

An array of optional options, namely, the 'ignored_functions' option to pass in functions to be ignored during profiling.

Return Values

null

Changelog

Version Description
PECL xhprof 0.9.2 The optional options parameter was added.

Examples

Example #1 xhprof_enable() examples

<?php
/ 1. elapsed time + memory + CPU profiling; and ignore built-in (internal) functions
xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);

/ 2. elapsed time profiling; ignore call_user_func* during profiling
xhprof_enable(
0,
array(
'ignored_functions' => array('call_user_func',
'call_user_func_array')));

/ 3. elapsed time + memory profiling; ignore call_user_func* during profiling
xhprof_enable(
XHPROF_FLAGS_MEMORY,
array(
'ignored_functions' => array('call_user_func',
'call_user_func_array')));
?>

See Also

add a note

User Contributed Notes 1 note

up
5
Vladimir Kovpak
9 years ago
<?php

/ You can optionally profile CPU time and/or memory usage:
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant