系统层面的性能微调工具_第1页
系统层面的性能微调工具_第2页
系统层面的性能微调工具_第3页
系统层面的性能微调工具_第4页
系统层面的性能微调工具_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Oprofile系统层面的性能微调工具褚霸核心系统数据库组2010/11/15用途及关键特性 非侵入式,无需重新编译系统. 整个系统层面的Profile, All code is profiled. 利用硬件计数器. 低overhead. OProfile is a system-wide profiler for Linux systems, capable of profiling all running code at low overhead.Oprofile系统工作流图安装(RHEL5U4)首先需要安装内核符号信息rpm -i kernel-debu

2、ginfo-common-2.6.18-164.el5.x86_64.rpmrpm -i kernel-debuginfo-2.6.18-164.el5.x86_64.rpm安装好的vmlinux在这里: /usr/lib/debug/lib/modules/2.6.18-164.el5/vmlinuxOprofile发行版内置的,无需安装,最新版本0.9.6文档: man oprofile官方网站: http:/ CPU上可以观测的事件列表:opcontrol -list-events 设置事件:opcontrol -setup -event=name:count:unitmask:kern

3、el:user -event=xxxx 常用的事件有以下几种: CPU_CLK_UNHALTED: CPU执行时间 LLC_MISSES: 末级Cache miss DTLB_MISSES: 数据TLB miss准备我们的程序我们的程序,包括内核驱动都需要有符号信息: 应用程序这样编译:gcc -g foo.c . 查看内核的导出的符号信息:cat /proc/kallsyms 初始化Oprofile# 加载oprofile内核模块opcontrol -init #我们对内核的取样没兴趣opcontrol -setup -no-vmlinux#我们需要内核的取样 opcontrol -setu

4、p -vmlinux=/usr/lib/debug/lib/modules/2.6.18-164.el5/vmlinux采样数据#在开始收集采样数据前回顾下我们的设置opcontrol -status#清除上一次采样到的数据opcontrol -reset #启动oprofiled守护程序,从内核中拉出采样数据 opcontrol -start #运行我们的程序./foo #中途收集采样数据opcontrol -dump#关闭守护程序, 同时准备好采样的数据opcontrol -shutdown采样报告 #系统级别的opreport -long-filenames#模块级别的opreport

5、image:foo -l#源码级别的opannotate image:foo -s最常用的命令opcontrol -init opcontrol -setup -no-vmlinux opcontrol -status opcontrol -startopcontrol -dumpopcontrol -shutdownopcontrol -reset opreport -long-filenames opreport image:filename -l opannotate image:filename -s 实例演示-代码(ex1.c)#include const char* find_st

6、r(const char* s, int l) const char* e = s+l; while(s e) if(*s = ) return s; s+; int main(int argc, char* argv) char*s = argv1; int i, l; if(argc =1) return -1; l=strlen(s); for(i = 0; i 100000000; i+) find_str(s, l); return 0; 一步步来看下实际效果opcontrol -setup -e CPU_CLK_UNHALTED:6000:0:0:1opcontrol -statusopcontrol -reset & opcontrol -start time ./ex1 helloworld opcontrol -shutdownopannotate image:/home/w

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论