How to Turn On/Off Xdebug Profiling at Runtime?

假装没事ソ 提交于 2019-12-10 17:12:03

问题


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.

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?


回答1:


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.

Alternatively there is the xhprof extension.

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



来源:https://stackoverflow.com/questions/9473071/how-to-turn-on-off-xdebug-profiling-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!