xhprof_enable
(PECL xhprof >= 0.9.0)
xhprof_enable — xhprof プロファイラを開始する
説明
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) functionsxhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);// 2. elapsed time profiling; ignore call_user_func* during profilingxhprof_enable( 0, array('ignored_functions' => array('call_user_func', 'call_user_func_array'))); // 3. elapsed time + memory profiling; ignore call_user_func* during profilingxhprof_enable( XHPROF_FLAGS_MEMORY, array('ignored_functions' => array('call_user_func', 'call_user_func_array')));?>
参考
- xhprof_disable() - xhprof プロファイラを終了する
- xhprof_sample_enable() - サンプリングモードでの XHProf プロファイリングを開始する
- memory_get_usage() - PHP に割り当てられたメモリの量を返す
- getrusage() - 現在のリソース使用状況を取得する