日期:2014-05-17  浏览次数:20505 次

【PHP】为项目引入函数级的性能监控
  作者:zhanhailiang 日期:2013-03-18

使用PHP扩展Xhprof来实现函数级的性能监控。

引用官方对Xhprof的描述:

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based navigational interface. The raw data collection component is implemented in C (as a PHP extension). The reporting/UI layer is all in PHP. It is capable of reporting function-level inclusive and exclusive wall times, memory usage, CPU times and number of calls for each function. Additionally, it supports ability to compare two runs (hierarchical DIFF reports), or aggregate results from multiple runs.
提供函数级别的性能信息,例如调用次数,其中包括阻塞时间,内存使用情况和CPU时间。

1. 安装与配置

/data/software # wget http://pecl.php.net/get/xhprof-0.9.2.tgz
/data/software # tar zxvf xhprof-0.9.2.tgz
/data/software # cd xhprof-0.9.2/
/data/software/xhprof-0.9.2 # ls -alp
总计 968
drw