loggingPHP脚本的执行时间和内存使用情况的正确方法是什么?

我想监视运行在Nginx + FPM上的Web应用程序的执行时间和内存使用情况。 为此,我在页脚中生成执行时间和内存数据。 我也可以将其插入到FPM错误日志文件中,稍后阅读:

error_log("Performance Execution=$execution, Memory=$memory");

从/var/log/php-fpm.log文件获取的数据如下所示:

 raijin log # tail -f php-fpm.log | grep "Performance" [02-Mar-2013 17:48:57] WARNING: [pool www] child 5546 said into stderr: "NOTICE: PHP message: Performance Execution=0.076794, Memory=11.276" [02-Mar-2013 17:48:58] WARNING: [pool www] child 5547 said into stderr: "NOTICE: PHP message: Performance Execution=0.075967, Memory=11.276" [02-Mar-2013 17:49:30] WARNING: [pool www] child 5548 said into stderr: "NOTICE: PHP message: Performance Execution=0.085233, Memory=11.276" [02-Mar-2013 17:49:33] WARNING: [pool www] child 5549 said into stderr: "NOTICE: PHP message: Performance Execution=0.077445, Memory=10.672" [02-Mar-2013 17:49:35] WARNING: [pool www] child 5546 said into stderr: "NOTICE: PHP message: Performance Execution=0.075163, Memory=10.044" 

我想收集这些信息并使用像collectd或MRTG这样的东西来logging它。 所以我的问题是:

  1. 有没有更好的方式来logging性能细节,稍后由collectd或MRTG读取?
  2. 如何将这些数据导入日志程序?