dow98764 2016-10-28 05:52
浏览 107
已采纳

qcachegrind错误:未知的文件格式。 从php xdebug生成的文件

I am attempting to use xdebug to profile an application written in php7.

I've written a script that sets the follow ini settings:

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();

Running the script created the cachegrind files as I would expect:

root@host:/# ls /tmp | grep cachegrind
cachegrind.out.0028fd.xt
cachegrind.out.0072ab.xt
cachegrind.out.009b09.xt
cachegrind.out.025ac3.xt

Here is the first few lines of a cachegrind file so that the format is visible:

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

However, when I try to open this file in qcachegrind, it fails to open:

enter image description here

The error message reads: "Error loading /path/to/cachegrind/file: Unknown file format

Anyone know what's going on here? I'd like to be able to use a tool like this to profile my application.

I also shelled out $30 to try opening the file in MCG but that app crashes immediately upon opening any of these files.

As a side note, the file is fairly large, but not so large that I'd expect apps to be freaking out:

❯ 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
  • 写回答

1条回答 默认 最新

  • douqu2712 2016-10-28 07:59
    关注

    that file is a trace file not a callgrind file.

    i seems you set trace_output_name and profiler_output_name in the ini to the same string or trying to open the wrong file. you need to set the profiling_* variables in the ini. see: "Profiling PHP Scripts" in the xdebug docs

    a sample profiling output looks like this:

        version: 1
        creator: xdebug 2.1.1rc1
        cmd: /Users/foo/bar/test1.php
        part: 1
        positions: line
    
        events: Time
    
        fl=php:internal
        fn=php::microtime
    

    when you get problems because of the file size, you could also try the app from profilingviewer.com

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。