如何在运行时打开/关闭 Xdebug 分析? [英] How to Turn On/Off Xdebug Profiling at Runtime?

查看:69
本文介绍了如何在运行时打开/关闭 Xdebug 分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 xdebug 并尝试使用 KCacheGrind 进行分析和查看.我将它设置为仅对触发器进行操作,即通过 GET 传递 XDEBUG_PROFILE=1.

I am currently using xdebug and experimenting with profiling and viewing w/ KCacheGrind. I have it set to only operate on trigger, i.e. passing XDEBUG_PROFILE=1 via GET.

关于我正在使用的框架的输出中有很多干扰,并且希望能够专门分析我的一部分代码,例如控制器,而不是整个请求.

There is a lot of noise in the output concerning the framework I am using and would like to be able to specifically profile a chunk of my code, like a controller, rather than the entire request.

我是否可以关闭 xdebug 分析,直到我选择将其打开(例如在控制器中),然后在需要时将其关闭?

Am I able to have xdebug profiling turned off until I choose to turn it on, like in a controller, and then turn it back off when I want?

推荐答案

我是否可以关闭 xdebug 分析,直到我选择将其打开(例如在控制器中),然后在需要时将其关闭?

Am I able to have xdebug profiling turned off until I choose to turn it on, like in a controller, and then turn it back off when I want?

不,您要么配置请求,要么不配置.您不能在同一个请求中在一个功能中打开它并在另一个功能中切换它.

No, you either profile the request or you won't. You can not switch it on in one function and switch it of in another within the same request.

以某种方式对单个请求没有多大意义,因为您需要衡量应用程序的每个部分与其他部分的相关性.

It wouldn't make much sense for a single request somehow, because you need to metric each part of the application in relevance to the other parts.

或者有 xhprof 扩展.

如果您需要分析特定区域内随时间推移的数据,请查看Pinba PHP 扩展.

If you need to profile data over time from within specific areas, take a look at the Pinba PHP Extension.

这篇关于如何在运行时打开/关闭 Xdebug 分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆