oprofile 使用之三(run 使用时间采样)
来源:互联网 发布:网络歌曲犯错 编辑:程序博客网 时间:2024/06/05 10:26
经历了上述的失败,只能走第2条路,时间采样。
1.修改opcontrol脚本加载驱动的参数,搜索modprobe oprofile 修改为 modprobe oprofile timer=1
2.pcontrol --init 插入oprofile.ko驱动 挂载oprofilefs
3. opcontrol --no-vmlinux --setup --session-dir=/opt/gtk/testop/ 如果不设置--session-dir那么后续分析会出现opannotate error: Invalid sample file, bad magic number,暂时不知道为什么。
4.使用如下代码保存成multiply.c 编译 arm-linux-gcc -g multiply.c -o multiply.arm
int fast_multiply(x, y) /multiply.c
{
return x * y;
}
int slow_multiply(x, y)
{
int i, j, z;
for (i = 0, z = 0; i < x; i++)
z = z + y;
return z;
}
int main()
{
int i,j;
int x,y;
for (i = 0; i < 2000; i ++) {
for (j = 0; j < 30 ; j++) {
x = fast_multiply(i, j);
y = slow_multiply(i, j);
}
}
return 0;
}
5.执行如下命令
opcontrol --start && ./multiply.arm && opcontrol --dump && opcontrol --stop
启动采样 执行程序 转储采样信息 停止采样
6.执行如下命令
opannotate --source ./multiply.arm 进行采样信息分析
出现如下错误
opannotate error: No sample file found: try running opcontrol --dump
or specify a session containing sample files
执行 opannotate --source ./multiply.arm --session-dir=/opt/gtk/testop/
出现如下错误
warning: /opt/gtk/multiply.arm could not be found.
opannotate (warning): no debug information available for binary Segmentation fault
执行opannotate --source ./multiply.arm --session-dir=/opt/gtk/testop --root=/
成功打印出分析的信息
至此我们的oprofile运行分析成功。
- oprofile 使用之三(run 使用时间采样)
- oprofile 使用之三(run 使用时间采样)
- oprofile 使用之二(run 使用事件采样)
- oprofile 使用之二(run 使用事件采样)
- oprofile 使用之三(注意事项)
- Profile 工具系列之三:oprofile(Android,未成功)
- oprofile 使用之四(注意事项---灰常重要)
- oprofile 使用之一(build)
- oprofile 使用之一(build)
- 解决龙芯2F使用oprofile-0.9.7无法采样应用程序函数的问题
- stm32f407之三ADC交替采样(操作寄存器)
- 信号与系统之(三)采样定律
- 采样之拒绝采样
- Oprofile工具的使用
- 使用oprofile 过程
- Linux oprofile 使用
- 初次使用oprofile
- OProfile安装和使用
- oprofile 使用之一(build)
- WinForm中log4net配置说明和使用
- oprofile 使用之二(run 使用事件采样)
- VS2008快捷键
- How to Parse HTML on iOS
- oprofile 使用之三(run 使用时间采样)
- oprofile 使用之四(注意事项---灰常重要)
- Windows 调试工具入门-2-基本调试操作
- PLSQL客户端连接虚拟机(linux)下Oracle配置
- javascript自定义事件createEvent initEvent dispatchEvent
- 用adb shell 打开手机上的一个database文件,提示 “sqlite3: command not found”
- 电子产品开发术语
- Hibernate HQL基础 限定查询条件
- QT focusInEvent 事件