oprofile利用cpu硬件层面提供的性能计数器(performance counter),通过计数采样,帮助我们从进程、函数、代码层面找出占用cpu的"罪魁祸首"。

常用命令

使用oprofile进行cpu使用情况检测,需要经过初始化、启动检测、导出检测数据、查看检测结果等步骤,以下为常用的oprofile命令。

初始化

  • opcontrol --no-vmlinux : 指示oprofile启动检测后,不记录内核模块、内核代码相关统计数据
  • opcontrol --init : 加载oprofile模块、oprofile驱动程序

检测控制

  • opcontrol --start : 指示oprofile启动检测
  • opcontrol --stop : 指示oprofile启动检测
  • opcontrol --dump : 指示将oprofile检测到的数据写入文件
  • opcontrol --reset : 清空之前检测的数据记录
  • opcontrol -h : 关闭oprofile进程

查看检测结果

  • opreport : 以镜像(image)的角度显示检测结果,进程、动态库、内核模块属于镜像范畴
  • opreport -l : 以函数的角度显示检测结果
  • opreport -l test : 以函数的角度,针对test进程显示检测结果
  • opannotate -s test : 以代码的角度,针对test进程显示检测结果
  • opannotate -s /lib64/libc-2.4.so : 以代码的角度,针对libc-2.4.so库显示检测结果

性能调试工具——oprofile的更多相关文章

  1. 九大Java性能调试工具,必备至少一款

    九款Java性能调试工具,有什么更好.更多的工具,欢迎补充. NetBeans Profiler NetBeans中可以找到NetBeans Profiler. NetBeans分析器是NetBean ...

  2. Linux下性能调试工具运维笔记

    作为一名资深的linux运维工程师,为方便了解和追求服务器的高性能,如cpu.内存.io.网络等等使用情况,要求运维工程师必须要熟练运用一些必要的系统性能调试工具,liunx下提供了众多命令方便查看各 ...

  3. 读书笔记iOS-Core-Animation-Advanced-Techniques,iOS性能调试工具

    调试卡顿,除了使用timer profile,还可以使用 OpenGL ES驱动工具 OpenGL ES Driver工具显示的GPU利用率,打开Color Blended Layers 我们给图片和 ...

  4. php性能调试工具介绍

    php版本:php7 xhprof: xhprof是php5.*下很好的性能测试工具,配合xhprof_html能够图形显示测试结果,基本够用, 但已经没人维护了. tideways: 在php7下, ...

  5. 苹果Instruments/Shark性能调试工具概述

    在Mac OS X上你可以使用Gprof这样的UNIX工具用于测试程序性能.当然,Apple也有自己的Profiling Tools,用得比较多的是Shark.10.5里还引入了一个基于DTrace的 ...

  6. 【ASP.NET MVC路由测试+性能调试工具】

    http://getglimpse.com https://github.com/Glimpse/Glimpse 百度网盘: http://pan.baidu.com/s/1jHuTtKa

  7. 开源的Delphi性能调试工具

    官网:http://dbg-spider.net/源码:https://github.com/yavfast/dbg-spider Real time profiler for Delphi appl ...

  8. OProfile 性能分析工具

    OProfile 性能分析工具 官方网站:http://oprofile.sourceforge.net/news/ oprofile.ko模块本文主要介绍Oprofile工具,适用系统的CPU性能分 ...

  9. Android界面性能调优手册

    界面是 Android 应用中直接影响用户体验最关键的部分.如果代码实现得不好,界面容易发生卡顿且导致应用占用大量内存. 我司这类做 ROM 的公司更不一样,预装的应用一定要非常流畅,这样给客户或用户 ...

随机推荐

  1. LeetCode OJ:Combination Sum (组合之和)

    Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...

  2. make和makefile介绍

    <strong>先附上一个比较简单的,测试代码用的Makefile</strong> </pre><pre code_snippet_id="463 ...

  3. MyEclipse Tern was unable to complete your request in time

    1.错误描述 2.错误原因 由错误提示可知,是由于MyEclipse Tern不能及时完成回复 3.解决办法 (1)Window--->Preferences--->MyEclipse-- ...

  4. JS同源策略和跨域访问

    同源策略(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,则浏览器的正常功能可能都会受到影响.可以说Web是构建在同源策略基础之上的,浏览器只 ...

  5. opencv 卡尔曼滤波器例子,自己修改过

    一.卡尔曼滤波器的理论解释 http://blog.csdn.net/lindazhou2005/article/details/1534234(推荐) 二.代码中一些随机数设置函数,在opencv中 ...

  6. Kali Linux:使用nmap扫描主机

    nmap-Network Mapper,是著名的网络扫描和嗅探工具包.他同样支持Windows和OS X. 扫描开放端口和判断操作系统类型 先让我们ping一段地址范围,找到启动的主机: # nmap ...

  7. [转载] ffmpeg Windows下采集摄像头一帧数据,并保存为bmp图片

    这里请注意,在编译ffmpeg时,不要使用--disable-devices选项. 使用 --enable-encoder=rawvideo --enable-decoder=rawvideo 启用r ...

  8. HDU - 5289:Assignment(单调队列||二分+RMQ||二分+线段树)

    Tom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this com ...

  9. bzoj 4806 炮

    Written with StackEdit. Description 众所周知,双炮叠叠将是中国象棋中很厉害的一招必杀技.炮吃子时必须隔一个棋子跳吃,即俗称"炮打隔子". 炮跟炮 ...

  10. LeetCode Construct Binary Tree from String

    原题链接在这里:https://leetcode.com/problems/construct-binary-tree-from-string/description/ 题目: You need to ...