PHP Conference Japan 2024

xhprof_disable

(PECL xhprof >= 0.9.0)

xhprof_disable停止 xhprof 分析器

說明

xhprof_disable(): 陣列

停止分析器,並返回執行期間的 xhprof 資料。

參數

此函式沒有參數。

回傳值

一個包含執行期間 xhprof 資料的 陣列

範例

範例 #1 xhprof_disable() 範例

<?php
xhprof_enable
();

$foo = strlen("foo bar");

$xhprof_data = xhprof_disable();

print_r($xhprof_data);
?>

以上範例會輸出類似以下的內容:

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

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

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

)
新增註記

使用者貢獻的註記 2 則註記

FatBat
10 年前
使用 XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY 的原始輸出片段。

[main()] => 陣列
(
[ct] => 1 // 呼叫次數。
[wt] => 419 // 牆壁/等待時間 (毫秒)。
[cpu] => 0 // CPU 時間。
[mu] => 8264 // 記憶體使用量 (位元組)。
[pmu] => 0 // 最高記憶體使用量。
)
dave at sophoservices dot com
6 個月前
wt 欄位似乎是微秒,而不是指定的毫秒。
To Top