phpday 2027 - Call for Papers

xhprof_disable

(PECL xhprof >= 0.9.0)

xhprof_disable — Stops xhprof profiler

Description

function xhprof_disable(): ?array

Stops the profiler, and returns xhprof data from the run.

Parameters

This function has no parameters.

Return Values

An array of xhprof data, from the run. Returns null if profiling is not enabled.

Examples

Example #1 xhprof_disable() example

<?php
xhprof_enable();

$foo = strlen("foo bar");

$xhprof_data = xhprof_disable();

print_r($xhprof_data);
?>

The above example will output something similar to:

Array
(
    [main()==>strlen] => Array
        (
            [ct] => 1
            [wt] => 279
        )

    [main()==>xhprof_disable] => Array
        (
            [ct] => 1
            [wt] => 9
        )

    [main()] => Array
        (
            [ct] => 1
            [wt] => 610
        )

)

User Contributed Notes 2 notes

up
12
FatBat
12 years ago
Raw output snippet with, XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY.

[main()] => Array
(
    [ct] => 1                // number of calls.
    [wt] => 419              // wall/wait time (ms).
    [cpu] => 0               // cpu time.
    [mu] => 8264             // memory usage (bytes).
    [pmu] => 0               // peak memory usage.
)
up
0
dave at sophoservices dot com
2 years ago
the wt field appears to be microseconds, not milliseconds as specified.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top