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

array 锟侥匡拷选选锟筋,锟斤拷锟斤拷通锟斤拷锟斤拷锟斤拷 'ignored_functions' 选锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟杰凤拷锟斤拷锟叫碉拷某些锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

NULL

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
0.9.2 锟斤拷涌锟窖★拷锟� options 锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

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

锟轿硷拷

  • xhprof_disable() - 停止 xhprof 锟斤拷锟斤拷锟斤拷
  • xhprof_sample_enable() - 锟皆诧拷锟斤拷模式锟斤拷锟斤拷 XHProf 锟斤拷锟杰凤拷锟斤拷
  • memory_get_usage() - 锟斤拷锟截凤拷锟斤拷锟� PHP 锟斤拷锟节达拷锟斤拷
  • getrusage() - 锟斤拷取锟斤拷前锟斤拷源使锟斤拷状锟斤拷