简体   繁体   English

使用Xdebug配置cachegrind时遇到问题

[英]Trouble configuring cachegrind with Xdebug

I am trying to configure Xdebug for cachegrind but I can't manage to enable the profiler feature in order to dump executed web pages. 我正在尝试为cachegrind配置Xdebug但我无法启用分析器功能以转储已执行的网页。

I'm using the official guide (and a few more with similar settings) and it doesn't seem to work. 我正在使用官方指南 (还有一些类似的设置),它似乎不起作用。

I've tried on both of my Linux machines (Ubuntu and Fedora). 我试过我的两台Linux机器(Ubuntu和Fedora)。 Xdebug is working fine for debugging and I can start valgrind --tool=cachegrind for an application so both should be installed properly. Xdebug工作正常,我可以为应用程序启动valgrind --tool=cachegrind ,因此两者都应该正确安装。

I was activating and deactivating profiler_enable and profiler_enable_trigger options in php.ini and restarting the server, no luck. 我正在激活和停用php.ini中的profiler_enable和profiler_enable_trigger选项并重新启动服务器,没有运气。 Changed the output directory as I thought that it might be related to permissions. 更改了输出目录,因为我认为它可能与权限有关。 Using the ?XDEBUG_PROFILER=1 flag in the URL as a parameter doesn't seem to help either. 在URL中使用?XDEBUG_PROFILER=1标志作为参数似乎也没有帮助。

Any other clues related to the configuration of cachegrind? 任何其他与cachegrind配置相关的线索?

The following basic xdebug.ini should do the trick: 以下基本的xdebug.ini应该可以解决这个问题:

; check that the path is ok for you
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.profiler_enable=1
xdebug.profiler_output_name = cachegring.out.%s
xdebug.profiler_output_dir = /tmp

Note that it enables the profiler for every request what is a significant performance issue. 请注意,它为每个请求启用了分析器,这是一个重要的性能问题。 However you should test if this works first. 但是你应该先测试一下是否有效。 If you see that it works, disable it per default. 如果您发现它有效,请默认禁用它。


About valgrind. 关于valgrind。

Note that it is not possible what you are trying to do. 请注意,您不可能尝试做什么。 The xdebug profiler isn't designed to work with / connect to valgrind. xdebug探查器不适用于/连接到valgrind。 It just uses the same output format as valgrind. 它只使用与valgrind相同的输出格式。 So, the format is the same as for example: 因此,格式与示例相同:

valgrind --tool=cachegrind --cachegrind-out-file=test.cachegrind ls -al

Usually you'll analyze the cachegrind files using a GUI program like kcachegrind on linux and wincachegrind on windows. 通常,您将使用GUI程序(如kcachegrind上的kcachegrind和Windows上的wincachegrind分析cachegrind文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM