gprof工具使用
来源:互联网 发布:投诉淘宝卖家电话多少 编辑:程序博客网 时间:2024/04/30 20:57
gprof会精确的给出函数被调用的时间和次数,给出函数调用关系
gprof使用:
1. 在编译和链接阶段加入-pg2. 重新编译代码
3. 运行生成的可执行程序,在可执行程序当前目录下生成gmon.out
4. 用 gprof 工具分析 gmon.out 文件
gprof ./gwcap gmon.out -p
-p参数标识“flat profile”模式,在分析结果中不显示函数的调用关系,AIX平台默认此参数有效。
输出以下内容:
清单 2. flat profile 的结果
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
80.38 203.27 203.27 50000 4.07 4.07 b
19.61 252.87 49.60 50000 0.99 0.99 a
0.00 252.88 0.01 main
上面结果中各个列的含义如下:
%time 函数以及衍生函数(函数内部再次调用的子函数)所占的总运行时间的百分比
cumulative seconds 函数累计执行的时间
self seconds 函数执行占用的时间
calls 函数的调用次数
self ms/call 每一次调用函数花费的时间microseconds,不包括衍生函数的运行时间
total ms/call 每一次调用函数花费的时间microseconds,包括衍生函数的运行时间
name 函数名称
列的含义,在gprof的输出结果中都有详细的说明。
Usage: gprof [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]
[-d[num]] [-k from/to] [-m min-count] [-t table-length]
[--[no-]annotated-source[=name]] [--[no-]exec-counts[=name]]
[--[no-]flat-profile[=name]] [--[no-]graph[=name]]
[--[no-]time=name] [--all-lines] [--brief] [--debug[=level]]
[--function-ordering] [--file-ordering]
[--directory-path=dirs] [--display-unused-functions]
[--file-format=name] [--file-info] [--help] [--line] [--min-count=n]
[--no-static] [--print-path] [--separate-files]
[--static-call-graph] [--sum] [--table-length=len] [--traditional]
[--version] [--width=n] [--ignore-non-functions]
[--demangle[=STYLE]] [--no-demangle] [@FILE]
[image-file] [profile-file...]
- gprof工具使用
- gprof工具使用介绍
- 工具GPROF
- gprof性能测试工具使用分析
- GPROF(性能监视工具)使用详解
- 性能评测工具 :gprof 的使用
- gprof使用
- gprof使用
- 使用Gprof
- Linux 下使用gprof (性能调优工具)
- (zz)使用gprof和oprofile工具分析系统性能
- ARM GNU 工具链在使用gprof中的一个bug
- 关于gprof系统性能查看工具的简单使用
- 使用gprof和oprofile工具分析系统性能
- Linux C++程序进行性能分析工具gprof使用入门
- Linux C++程序进行性能分析工具gprof使用入门
- gprof性能分析工具使用介绍和Amdahl定律
- 程序分析工具gprof
- 判断鼠标移动方向
- Mongodb有什么优势?相对关系型数据库如MySQL
- 数据库见表表名长度限制
- QT项目转成vs项目
- 解决NDK开发中的 Method 'NewStringUTF' could not be resolved
- gprof工具使用
- 二叉树 及其基本操作
- 程序员面试 刷题推荐
- 安卓自定义权限的使用
- 获取下拉值 及 弹出页面返回值
- 重置自增字段
- mysql建表时多个字段用到timestamp时报错怎么办
- 基础 python(二)运算符
- Python中list的交、并、差集获取方法