【发布时间】:2016-10-28 05:52:54
【问题描述】:
我正在尝试使用 xdebug 来分析用 php7 编写的应用程序。
我编写了一个脚本来设置以下ini 设置:
ini_set('xdebug.trace_format',1); // Note: I tried 0 and 2 here as well
ini_set('xdebug.profiler_enable',1);
xdebug_start_trace('/tmp/cachegrind.out');
// RUN CODE HERE
xdebug_stop_trace();
运行脚本会如我所料创建缓存研磨文件:
root@host:/# ls /tmp | grep cachegrind
cachegrind.out.0028fd.xt
cachegrind.out.0072ab.xt
cachegrind.out.009b09.xt
cachegrind.out.025ac3.xt
这里是 cachegrind 文件的前几行,以便格式可见:
Version: 2.4.1
File format: 4
TRACE START [2016-10-28 05:26:57]
2 3784 1 0.242945 2692856
2 3785 0 0.242955 2692800 DI\Container->set 1 /path/public/api/index.php 100
2 3785 1 0.242966 2692800
2 3786 0 0.242973 2692800 spl_autoload_call 0 /path/public/api/index.php 103
3 3787 0 0.242982 2692896 Fuel\Core\Autoloader::load 1 /path/public/api/index.php 103
4 3788 0 0.242990 2692896 strpos 0 /path/fuel/core/classes/autoloader.php 219
但是,当我尝试在qcachegrind 中打开此文件时,它无法打开:
错误消息显示:“加载/path/to/cachegrind/file时出错:未知文件格式
有人知道这里发生了什么吗?我希望能够使用这样的工具来分析我的应用程序。
我还花了 30 美元尝试在 MCG 中打开文件,但打开这些文件中的任何一个后,该应用程序都会立即崩溃。
附带说明,该文件相当大,但没有大到我认为应用程序会吓坏的程度:
❯ ls -al /Users/johnpc/repos/cachegrind.out.094ffa.xt
-rw-r--r-- 1 johnpc staff 62744095 Oct 28 02:13 /Users/johnpc/repos/cachegrind.out.094ffa.xt
【问题讨论】:
标签: php profiling xdebug xdebug-profiler qcachegrind