在 Zend Framework 中查找执行时间的最佳实践方法
我对查找 Zend Framework 应用程序的执行时间的最佳/标准方法感兴趣。目前,我正在 public/index.php 上启动计时器,然后在 Zend_Registry 中注册它,以供稍后调用,然后布局使用它来计算总时间。
有更好的方法吗?我知道这甚至不完全准确,因为 postDispatch() 中仍然(或至少可以)执行一些执行,该执行将在视图渲染后运行。
I'm interested in the best/standard way to find the execution time of my Zend Framework app. Currently I'm starting the timer on the public/index.php then registering it in Zend_Registry, for a later call, which the layout then uses to calculate the total time.
Is there a better way to do this? I know this isn't even entirely accurate, as there is still (or at least, can be) some execution in the postDispatch() which will be ran after the view is rendered.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终
在引导程序启动之前添加了内容,并将其放在
layout.phtml的末尾作为结束主体标记之前的最后一件事
I ended up adding
before the bootstrapper got intsantiated, and put
at the end of my layout.phtml as the last thing before the closing body tag
我自己使用 webgrind 和 xdebug 分析。这不仅提供了有关总执行时间的信息,还提供了给定方法执行的次数、执行时间等信息。
I myself use webgrind and xdebug profiling. This gives info not only about total execution time, but also e.g. how many times a given method was executed, what was the time of this execution, etc.
您可能想考虑启用真正的代码分析器,例如 XHProf。
You might want to look into enabling a real code profiler like XHProf.