我正在运行Ubuntu 16.10并尝试使用gprof来分析程序。 我用标志-pg编译,程序是单线程的。 实际的编译命令是:
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 ,我得到的输出不包含数字。 我只是得到表格标题和不同领域的解释,像这样:
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,else blank. total the average number of milliseconds spent in this ms/call function and its descendents per call,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 ,但结果相同。 有人知道什么是错的吗?
在Linux程序中跟踪积极使用的内存
如何跟踪文件下载
在程序启动时测量dynamic链接所花的时间?
使用C ++在Linux中计算磁盘读/写
使用nvprof和Visual Profiler进行GPU功耗分析
Oprofile vs perf
确定专用词的词频
Perfmon,PerfMonitor和PerfView
如何使分析器(valgrind,perf,pprof)在使用mpirun时选取/使用具有debugging符号的库的本地版本?
测量时间:gettimeofday,TSC和时钟滴答声之间的差异
正如Tony Beta Lambda在上面的评论中指出的那样,这是gcc中的一个bug 。 有两种可能的解决方法:降级到gcc-4.9,或者用标志--no-pie编译。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。