- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我的源代码:
$ 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
为什么 没有收集到 play.c 的信息
?如果我不使用调试符号构建,我希望看到这一点,但我做到了。
如果相关,这是 Debian "jessie",GCC 4.8.1 和 Valgrind 3.8.1。
最佳答案
将我要注释的源文件指定为相对路径是不够的,因此以下 2 个命令都不起作用:
$ 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):
$ callgrind_annotate out play.c
其他两种形式(./play.c
和 ~/projects/utils/play.c
)不工作,这是一个 UX 错误。
关于Cachegrind 的 cg_annotate 不显示我的源代码的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18944716/
我的Angular-Component位于一个flexbox(id =“log”)中。可以显示或隐藏flexbox。 我的组件内部有一个可滚动区域,用于显示日志消息。 (id =“message-li
我真的很困惑 有一个 phpinfo() 输出: MySQL 支持 启用 客户端 API 版本 5.5.40 MYSQL_MODULE_TYPE 外部 phpMyAdmin 显示: 服务器类型:Mar
我正在研究这个 fiddle : http://jsfiddle.net/cED6c/7/我想让按钮文本在单击时发生变化,我尝试使用以下代码: 但是,它不起作用。我应该如何实现这个?任何帮助都会很棒
我应该在“dogs_cats”中保存表“dogs”和“cats”各自的ID,当看到数据时显示狗和猫的名字。 我有这三个表: CREATE TABLE IF NOT EXISTS cats ( id
我有一个字符串返回到我的 View 之一,如下所示: $text = 'Lorem ipsum dolor ' 我正在尝试用 Blade 显示它: {{$text}} 但是,输出是原始字符串而不是渲染
我无法让我的链接(由图像表示,位于页面左侧)真正有效地显示一个 div(包含一个句子,位于中间)/单击链接时隐藏。 这是我的代码: Practice
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
最初我使用 Listview 来显示 oracle 结果,但是最近我不得不切换到 datagridview 来处理比 Listview 允许的更多的结果。然而,自从切换到数据网格后,我得到的结果越来越
我一直在尝试插入一个 Unicode 字符 ∇ 或 ▽,所以它显示在 Apache FOP 生成的 PDF 中。 这是我到目前为止所做的: 根据这个基本帮助 Apache XSL-FO Input,您
我正在使用 node v0.12.7 编写一个 nodeJS 应用程序。 我正在使用 pm2 v0.14.7 运行我的 nodejs 应用程序。 我的应用程序似乎有内存泄漏,因为它从我启动时的大约 1
好的,所以我有一些 jQuery 代码,如果从下拉菜单中选择了带有前缀 Blue 的项目,它会显示一个输入框。 代码: $(function() { $('#text1').hide();
当我试图检查 Chrome 中的 html 元素时,它显示的是 LESS 文件,而 Firefox 显示的是 CSS 文件。 (我正在使用 Bootstrap 框架) 如何在 Chrome 中查看 c
我是 Microsoft Bot Framework 的新手,我正在通过 youtube 视频 https://youtu.be/ynG6Muox81o 学习它并在 Ubuntu 上使用 python
我正在尝试转换从 mssql 生成的文件到 utf-8。当我打开他的输出 mssql在 Windows Server 2003 中使用 notepad++ 将文件识别为 UCS-2LE我使用 file
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我正在尝试执行单击以打开/关闭一个 div 的功能。 这是基本的,但是,点击只显示 div,当我点击“关闭”时,没有任何反应。 $(".inscricao-email").click(function
假设我有 2 张卡片,屏幕上一次显示一张。我有一个按钮可以用其他卡片替换当前卡片。现在假设卡 1 上有一些数据,卡 2 上有一些数据,我不想破坏它们每个上的数据,或者我不想再次重建它们中的任何一个。
我正在使用 Eloquent Javascript 学习 Javascript。 我在 Firefox 控制台上编写了以下代码,但它返回:“ReferenceError:show() 未定义”为什么?
我正在使用 Symfony2 开发一个 web 项目,我使用 Sonata Admin 作为管理面板,一切正常,但我想要做的是,在 Sonata Admin 的仪表板菜单上,我需要显示隐藏一些菜单取决
我试图显示一个div,具体取决于从下拉列表中选择的内容。例如,如果用户从列表中选择“现金”显示现金div或用户从列表中选择“检查”显示现金div 我整理了样本,但样本不完整,需要接线 http://j
我是一名优秀的程序员,十分优秀!