oprofile整理
来源:互联网 发布:转化vr视频软件 编辑:程序博客网 时间:2024/05/16 00:28
前序:在网上搜资料的时候,经常会看见comcat关于龙芯的文章,对其的借鉴尤多,为了向其学习,本打算以后所有ID一 律更名为comeagle,不过貌似这个称号太长了~~ 大家有什么好点的名字,多多提意见!
oprofile起源于John Levon (Victoria U of Manchester)的一篇硕士论文,最初它以DCPI(DEC Continuous Profiling Infrastructure)为模型,并最先支持Intel Pentium Pro和AMD Athlon。oprofile主要是通过采样,利用CPU上的性能计数器(perfomance counter,在龙芯上分别为CP0的24和25号寄存器)统计某些事件的发生次数。它由内核模块和用户空间守护进程两部分组成,前者可以访问性能计数器,后者则负责从性能计数器收集数据。
oprofile有两种采样方式:基于事件的采样(performance counter)和基于事件的采样(timer)。前者需要CPU上性能计数器的支持,可以人为选择要profiling的事件类型。后者适用于无性能计数器的CPU,记录每一个时钟周期。
oprofile使用(事件模式):
1、在2.6及其以后版本的Linux中都以模块方式集成了oprofile,如要使用,首先加载。
opcontrol --init
2、清除oprofile中的历史数据。
opcontrol --reset
3、配置
opcontrol --setup --event=name:count:unitmask:kernal:user
name:事件名
count:计数器值,即事件发生多少次后,oprofile记录一次
unitmask:硬件单元任务
kernal:cpu在OS内核运行时是否统计(0或者1)
user:cpu在OS用户级是否统计(0或者1)
其中oprfile所支持的事件类型可以通过使用命令opcontrol -l获取。
例:opcontrol --setup --event=CYCLES:1000::0:1 --event=ITLB_MISSES:1000::0:1
性能计数器0和1分别统计时钟和ITLB缺失事件,事件每发生1000次oprofile记录一次,硬件单元任务为0x0f,cpu处 于内核级不计数,处于用户级则计数。
4、启动
opcontrol --start/-s
5、运行要检测的程序
./a.out
6、由用户级守护进程取出统计数据
opcontrol --dump/-d
7、停止
opcontrol --stop/-t 停止核心模块
opcontrol --shutdown/-h 停止用户级守护进程
8、读取数据
opreport -l -o data.txt 将整体统计数据存入data.txt
opannotate -s --output-dir=an/ 在源程序中添加注释,并按照源文件的目录结构生成目录an
oprofile使用手册:
oprofile起源于John Levon (Victoria U of Manchester)的一篇硕士论文,最初它以DCPI(DEC Continuous Profiling Infrastructure)为模型,并最先支持Intel Pentium Pro和AMD Athlon。oprofile主要是通过采样,利用CPU上的性能计数器(perfomance counter,在龙芯上分别为CP0的24和25号寄存器)统计某些事件的发生次数。它由内核模块和用户空间守护进程两部分组成,前者可以访问性能计数器,后者则负责从性能计数器收集数据。
oprofile有两种采样方式:基于事件的采样(performance counter)和基于事件的采样(timer)。前者需要CPU上性能计数器的支持,可以人为选择要profiling的事件类型。后者适用于无性能计数器的CPU,记录每一个时钟周期。
oprofile使用(事件模式):
1、在2.6及其以后版本的Linux中都以模块方式集成了oprofile,如要使用,首先加载。
opcontrol --init
2、清除oprofile中的历史数据。
opcontrol --reset
3、配置
opcontrol --setup --event=name:count:unitmask:kernal:user
name:事件名
count:计数器值,即事件发生多少次后,oprofile记录一次
unitmask:硬件单元任务
kernal:cpu在OS内核运行时是否统计(0或者1)
user:cpu在OS用户级是否统计(0或者1)
其中oprfile所支持的事件类型可以通过使用命令opcontrol -l获取。
例:opcontrol --setup --event=CYCLES:1000::0:1 --event=ITLB_MISSES:1000::0:1
性能计数器0和1分别统计时钟和ITLB缺失事件,事件每发生1000次oprofile记录一次,硬件单元任务为0x0f,cpu处 于内核级不计数,处于用户级则计数。
4、启动
opcontrol --start/-s
5、运行要检测的程序
./a.out
6、由用户级守护进程取出统计数据
opcontrol --dump/-d
7、停止
opcontrol --stop/-t 停止核心模块
opcontrol --shutdown/-h 停止用户级守护进程
8、读取数据
opreport -l -o data.txt 将整体统计数据存入data.txt
opannotate -s --output-dir=an/ 在源程序中添加注释,并按照源文件的目录结构生成目录an
oprofile使用手册:
http://oprofile.sourceforge.net/doc/index.html
- oprofile整理
- oprofile整理
- oprofile整理
- oprofile
- oprofile
- Oprofile
- oprofile
- oprofile
- OProfile
- oProfile
- oprofile
- oprofile
- OProfile
- OProfile manual
- Gprof & OProfile
- Oprofile使用指南
- 安装oprofile
- oprofile实战
- 我的java之路之java的变量
- eclipse启动tomcat访问不到主页
- Android入门:调用WebService
- android listview优化及其解释
- Java Class文件深度格式解析
- oprofile整理
- Delphi 数据类型列表
- ext2文件系统
- FL_RIDCore1.0 注册组件
- dll和so文件区别与构成
- 手动搭建ssh框架
- 用 OProfile 彻底了解性能[IBM]
- 【PHP】MySQL 数据库操作类
- 经过一段时间的卸载重装,算是对myeclipse连接oracle有了点了解,写此文,希望后学者不要重蹈覆辙!