首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gprof产生空输出

gprof产生空输出
EN

Stack Overflow用户
提问于 2017-03-06 07:42:40
回答 1查看 7.9K关注 0票数 26

我正在运行Ubuntu16.10并试图使用gprof来分析一个程序。我使用标志-pg进行编译,程序是单线程的.实际的编译命令是:

代码语言:javascript
复制
g++ -I. -std=c++11 -Wall -Wextra -O3 -pg -fPIC -Wno-unused-parameter -c -o build/obj/performance/stencil_application.o test/performance/stencil_application.cpp
g++ -I. -std=c++11 -Wall -Wextra -O3 -pg -Wno-unused-parameter build/obj/performance/stencil_application.o -o build/test/performance/stencil_application

当我运行它时,程序需要几秒钟才能完成,并生成一个名为gmon.out的文件。但是,当我运行gprof ./build/test/performance/stencil_application时,我得到的输出不包含数字。我只得到表标题和对不同字段的解释,如下所示:

代码语言:javascript
复制
Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    

 %         the percentage of the total running time of the
time       program used by this function.

cumulative a running sum of the number of seconds accounted
 seconds   for by this function and those listed above it.

 self      the number of seconds accounted for by this
seconds    function alone.  This is the major sort for this
           listing.

calls      the number of times this function was invoked, if
           this function is profiled, else blank.

 self      the average number of milliseconds spent in this
ms/call    function per call, if this function is profiled,
           else blank.

 total     the average number of milliseconds spent in this
ms/call    function and its descendents per call, if this
           function is profiled, else blank.

name       the name of the function.  This is the minor sort
           for this listing. The index shows the location of
           the function in the gprof listing. If the index is
           in parenthesis it shows where it would appear in
           the gprof listing if it were to be printed.

Copyright (C) 2012-2016 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

                     Call graph (explanation follows)


granularity: each sample hit covers 2 byte(s) no time propagated

index % time    self  children    called     name

 This table describes the call tree of the program, and was sorted by
 the total amount of time spent in each function and its children.

诸若此类。

我也尝试过在没有-O3-g的情况下编译,但是结果是一样的。有人知道怎么回事吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-29 11:08:05

正如托尼·贝塔·兰博达( Tony )在上面的评论中指出的,这是一个gcc的“虫”。有两种可能的解决办法:将信用评级降至gcc-4.9,或者使用标志-no-pie进行编译。

票数 20
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42620074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档