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 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序