array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.xhprof-enable.php', 1 => 'xhprof_enable', ), 'up' => array ( 0 => 'ref.xhprof.php', 1 => 'Xhprof 函数', ), 'prev' => array ( 0 => 'function.xhprof-disable.php', 1 => 'xhprof_disable', ), 'next' => array ( 0 => 'function.xhprof-sample-disable.php', 1 => 'xhprof_sample_disable', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/xhprof/functions/xhprof-enable.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL xhprof >= 0.9.0)
xhprof_enable — 启动 xhprof 性能分析器
flags
分析添加额外信息的可选标记。
关于此标记的更多信息参见
XHprof 常量,例如,
XHPROF_FLAGS_MEMORY
可以开启内存的分析。
options
array 的可选选项,就是通过传递 'ignored_functions' 选项来忽略性能分析中的某些函数。
版本 | 说明 |
---|---|
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')));
?>