Cachegrind的cg_annotate不显示我的源代码的注释

相信

我的源代码:

$ cat play.c
int main() {
  return 0;
}

在其上构建并运行cachegrind

$ gcc -g -Wall play.c -o play && valgrind --tool=cachegrind --cachegrind-out-file=out ./play
==17670== Cachegrind, a cache and branch-prediction profiler
==17670== Copyright (C) 2002-2012, and GNU GPL'd, by Nicholas Nethercote et al.
==17670== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==17670== Command: ./play
==17670== 
--17670-- warning: L3 cache found, using its data for the L2 simulation.
==17670== 
==17670== I   refs:      97,846
==17670== I1  misses:       697
==17670== LLi misses:       692
==17670== I1  miss rate:   0.71%
==17670== LLi miss rate:   0.70%
==17670== 
==17670== D   refs:      36,490  (25,595 rd   + 10,895 wr)
==17670== D1  misses:     1,657  ( 1,185 rd   +    472 wr)
==17670== LLd misses:     1,503  ( 1,043 rd   +    460 wr)
==17670== D1  miss rate:    4.5% (   4.6%     +    4.3%  )
==17670== LLd miss rate:    4.1% (   4.0%     +    4.2%  )
==17670== 
==17670== LL refs:        2,354  ( 1,882 rd   +    472 wr)
==17670== LL misses:      2,195  ( 1,735 rd   +    460 wr)
==17670== LL miss rate:     1.6% (   1.4%     +    4.2%  )

最后,运行cg_annotate

$ cg_annotate out play.c
--------------------------------------------------------------------------------
I1 cache:         65536 B, 64 B, 2-way associative
D1 cache:         65536 B, 64 B, 2-way associative
LL cache:         6291456 B, 64 B, 48-way associative
Command:          ./play
Data file:        out
Events recorded:  Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw
Events shown:     Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw
Event sort order: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw
Thresholds:       0.1 100 100 100 100 100 100 100 100
Include dirs:     
User annotated:   play.c
Auto-annotation:  off

--------------------------------------------------------------------------------
    Ir I1mr ILmr     Dr  D1mr  DLmr     Dw D1mw DLmw 
--------------------------------------------------------------------------------
97,846  697  692 25,595 1,185 1,043 10,895  472  460  PROGRAM TOTALS

--------------------------------------------------------------------------------
    Ir I1mr ILmr    Dr D1mr DLmr    Dw D1mw DLmw  file:function
--------------------------------------------------------------------------------
22,411   13   13 7,443  157  130 3,653    1    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-lookup.c:do_lookup_x
17,322   10   10 3,596   87   83 1,828    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-lookup.c:_dl_lookup_symbol_x
15,697   19   19 3,594  557  543 1,927  245  238  /build/eglibc-TepTGA/eglibc-2.17/elf/../sysdeps/x86_64/dl-machine.h:_dl_relocate_object
 9,072    2    2 2,694   17   11     0    0    0  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../strcmp.S:strcmp
 8,262   13   13 2,053   84   70   119    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/do-rel.h:_dl_relocate_object
 4,118    6    6 1,732   17   15   497    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-lookup.c:check_match.9345
 1,201    2    2   197    0    0     2    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-minimal.c:strsep
 1,149   36   36   301    1    1   138   10   10  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:_dl_map_object_from_fd
 1,139   14   14   377   14   13   158   13   13  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-version.c:_dl_check_map_versions
 1,057   31   31   223    1    1   110    2    2  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-deps.c:_dl_map_object_deps
 1,008   13   13   252   11   11    76    3    3  /build/eglibc-TepTGA/eglibc-2.17/string/../string/memcmp.c:bcmp
   922   67   67   200   22   13   112   10   10  /build/eglibc-TepTGA/eglibc-2.17/elf/rtld.c:dl_main
   779    2    2   201    6    0   116    2    2  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-misc.c:_dl_name_match_p
   742    5    5    75    1    1     0    0    0  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../rtld-strlen.S:strlen
   727    4    4   114   10   10     0    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-cache.c:_dl_cache_libcmp
   606    4    4   114    0    0   112    1    1  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-minimal.c:__libc_memalign
   586   11   11    96    3    3   111   21   21  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-object.c:_dl_new_object
   549    8    8    96   14   14    47   12   12  /build/eglibc-TepTGA/eglibc-2.17/elf/get-dynamic-info.h:_dl_map_object_from_fd
   520   11   11   113    6    6    83    3    3  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:open_verify
   512   10   10    19    5    4   295   37   37  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../memset.S:memset
   458   11   11   135   16    0   112    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-reloc.c:_dl_relocate_object
   450   24   24    89    1    1    73    3    3  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:_dl_map_object
   408   11   11   113   16   14    26    4    4  /build/eglibc-TepTGA/eglibc-2.17/elf/../elf/dl-sysdep.c:_dl_sysdep_start
   377    5    5    54    2    1    39    3    3  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/memcpy.S:mempcpy
   369    5    5    59    0    0    47    6    6  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../memcpy.S:memcpy
   349   14   14    38    2    2    63    6    6  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:_dl_init_paths
   344    2    2   117   25   25     2    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-environ.c:_dl_next_ld_env_entry
   325    3    3     5    0    0   292   36   36  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-tls.c:_dl_allocate_tls_storage
   317   16   16    49   10   10    27    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-cache.c:_dl_load_cache_lookup
   311   14   14   105    0    0    42    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:open_path
   270   11   11    86    5    0    33    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-fini.c:_dl_fini
   266   11   11    46    6    6    20    7    7  /build/eglibc-TepTGA/eglibc-2.17/elf/get-dynamic-info.h:_dl_start
   257   20   20    46    0    0    39    3    3  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-hwcaps.c:_dl_important_hwcaps
   234    8    8    34    6    6    23    6    6  /build/eglibc-TepTGA/eglibc-2.17/elf/get-dynamic-info.h:dl_main
   232    4    4    73   14    0    35    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-init.c:call_init
   211    1    1    63   11   11    19    5    5  /build/eglibc-TepTGA/eglibc-2.17/elf/../sysdeps/x86_64/dl-machine.h:_dl_start
   207    2    2    18    3    3     0    0    0  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../strchr.S:index
   185    5    5    72    4    4    27    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-version.c:match_symbol
   181    7    7    49    1    0    25    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-fini.c:_dl_sort_fini
   175   17   13    83    1    0    21    1    1  ???:???
   175    6    6    20    4    2    19    6    6  /build/eglibc-TepTGA/eglibc-2.17/elf/rtld.c:_dl_start
   168   10   10    18    2    2     6    0    0  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../cacheinfo.c:handle_amd
   156    6    6    56    1    0    18    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/../elf/dl-runtime.c:_dl_fixup
   146    2    2    30    5    5     0    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/do-rel.h:_dl_start
   137   11   11    30    0    0    34    2    2  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-load.c:fillin_rpath
   125   14   14    11    1    0    29    4    2  /build/eglibc-TepTGA/eglibc-2.17/string/../sysdeps/x86_64/multiarch/../cacheinfo.c:init_cacheinfo
   111    3    3    36    0    0    51    5    5  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-error.c:_dl_catch_error
   106    3    3    26    0    0    20    0    0  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-object.c:_dl_add_to_namespace_list
   100    2    2    28    5    5    24    1    1  /build/eglibc-TepTGA/eglibc-2.17/elf/dl-lookup.c:_dl_setup_hash

--------------------------------------------------------------------------------
-- User-annotated source: play.c
--------------------------------------------------------------------------------
  No information has been collected for play.c

为什么No information has been collected for play.c呢?我希望看到的是,如果我没有使用调试符号进行构建,但是我做到了。

如果相关,这是Debian的“ jessie”(带有GCC 4.8.1和Valgrind 3.8.1)

相信

仅将我要注释的源文件指定为相对路径是不够的,因此以下两个命令都不起作用:

$ cg_annotate out play.c
$ cg_annotate out ./play.c

它必须是一条绝对路径:

$ cg_annotate out ~/projects/utils/play.c
[snip]
--------------------------------------------------------------------------------
-- User-annotated source: /home/tshepang/projects/utils/play.c
--------------------------------------------------------------------------------
Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw 

 2    0    0  0    0    0  1    0    0  int main() {
 1    0    0  0    0    0  0    0    0    return 0;
 2    0    0  2    0    0  0    0    0  }

[snip]

请注意,callgrind_annotate仅当按以下方式调用时,该方法才有效(当然,假设我们使用callgrind工具而不是cachegrind运行Valgrind ):

$ callgrind_annotate out play.c

其他两种形式(./play.c~/projects/utils/play.c)不起作用,这使其成为UX错误。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何让 cg_annotate 包含字典?

godoc不显示源代码

我的 RecyclerViewer 不显示视图。我找不到错误。我的源代码在这里

显示我的nuget的源代码

从源代码安装时,GNU Parallel不显示颜色

XCode不显示从源代码管理中拉出的文件

使用list命令时,GDB不显示源代码

反编译的《我的世界》源代码的javadoc注释在哪里?

如何让我的代码不显示最近的输入?

NetBeans GUI设计器窗口在设计和源代码之间切换不显示

使用Projucer创建Xcode项目-源代码管理不显示修改后的文件

如何让Sphinx-autoapi从源代码显示自定义注释

我们可以在不更改源代码的情况下编辑Spring验证注释吗?

我们如何在flex / bison源代码中添加注释?

为什么我的代码中不显示边距

.innerHTML 不显示我需要的 html 代码内容

xCode断点在调试时不显示我的代码

为什么我的代码不显示TButton的数组?

为什么我的硒代码不显示任何文本?

单击html中的“计算”后,我的代码什么也不显示

为什么我的中缀前缀代码不显示输出

为什么我的代码不显示更新日期?

从Java源代码中删除注释

从Python源代码中提取注释

源代码注释中的交叉引用

Python BeautifulSoup返回元素的空文本,浏览器显示文本,源代码不显示任何内容

我的ListView不显示

如果我可以在源代码中看到它,为什么我的工具提示没有显示?

Xcode版本10.0(10A255)-在源代码管理菜单中不显示与项目连接的svn(subversion)