CakeFest 2024: The Official CakePHP Conference

xhprof_enable

(PECL xhprof >= 0.9.0)

xhprof_enablexhprof プロファイラを開始する

説明

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

xhprof のプロファイリングを開始します。

パラメータ

flags

オプションのフラグで、プロファイル用の追加情報を指定します。フラグの詳細な情報は XHprof 定数 を参照ください。たとえば XHPROF_FLAGS_MEMORY はメモリのプロファイリングを有効にします。

options

オプション項目の配列。つまり、 'ignored_functions' オプションで関数を渡すと、 その関数のプロファイリングを無視したりできます。

戻り値

null

変更履歴

バージョン 説明
PECL xhprof 0.9.2 オプションのパラメータ options が追加されました。

例1 xhprof_enable() の例

<?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')));
?>

参考

add a note

User Contributed Notes 1 note

up
5
Vladimir Kovpak
8 years ago
<?php

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