一. 基本命令:
ophelp:列出帮助信息 opcontrol:设置各种控制参数,启动、停止数据收集。参考 Chapter 3, Controlling the profiler. opreport:产生报告信息。 opannotate:将源代码和测试数据关联起来,并产生报告数据 opgprof:产生gprof-style格式的数据oparchive:将收集到的数据打包,并移动到其它机器上
opimport:从其他位置导入数据,当需要在机器之间移动数据时,需要使用这个工具。
二. 基本流程
1.设置启动参数
opcontrol --setup --vmlinux=/boot/vmlinux-`uname -r`
--setup可以不输入
或者
opcontrol --no-vmlinux
opcontrol --start-daemon 只启动daemon,不开始收集数据
或者
opcontrol --start 启动daemon,并开始收集数据3. 将收集的数据更新到磁盘
opcontrol --dump
3. 停止收集数据、停止daemon
opcontrol --shutdown 停止收集数据,并停止daemon
opcontrol --stop 停止收集数据,但daemon继续run
三 高级使用
1 分割收集的数据
opcontrol --separate=××可在下表中选折。
none | No profile separation (default) |
lib | Create per-application profiles for libraries |
kernel | Create per-application profiles for the kernel and kernel modules |
thread | Create profiles for each thread and each task |
cpu | Create profiles for each CPU |
all | All of the above options |
opcontrol 选项 | 描述 |
--list-events | 列出处理器事件和单元屏蔽(unit mask) |
--vmlinux=<kernel image> | 将要分析的内核镜像文件 |
--no-vmlinux | 不分析内核 |
--reset | 清除当前会话中的数据 |
--setup | 在运行守护进程之前对其进行设置 |
--event=<processor event> | 监视给定的处理器事件 |
--start | 开始取样 |
--dump | 使数据流到守护进程中 |
--stop | 停止数据取样 |
-h | 关闭守护进程 |
参考连接
http://www.ibm.com/developerworks/cn/linux/l-pow-oprofile/
http://oprofile.sourceforge.net/doc/overview.html
http://www.ibm.com/developerworks/cn/linux/l-oprof/index.html