如何在php中评测concreate函数或代码段?

如何在php中评测concreate函数或代码段?,php,profiling,xdebug,Php,Profiling,Xdebug,假设我在生产服务器上有一个应用程序,我需要分析一些代码段,但不是整个应用程序,因为它的速度急剧下降 所以我需要这样的东西: enable_profiler() 函数_带有_瓶颈() 禁用_profiler() 有什么方法可以做到这一点吗?使用xhprof。你可以这样写: if ($_SERVER['REMOTE_ADDR'] == 'your_ip') { enable_profiler(); } function_with_bottle_neck(); if ($_SERVER['REMO

假设我在生产服务器上有一个应用程序,我需要分析一些代码段,但不是整个应用程序,因为它的速度急剧下降

所以我需要这样的东西:

enable_profiler()
函数_带有_瓶颈()
禁用_profiler()


有什么方法可以做到这一点吗?

使用xhprof。你可以这样写:

if ($_SERVER['REMOTE_ADDR'] == 'your_ip') {
 enable_profiler();
}
function_with_bottle_neck();

if ($_SERVER['REMOTE_ADDR'] == 'your_ip') {
 disable_profiler();
}