使用oprofile-1.1.0

oprofile的使用 本文介绍的是>=1.0.0版本的,以前的opcontrol是之前的版本,现在不推荐使用。 1.0.0版本之后使用的是operf, opreport, opannotate. 文档官方地址: https://oprofile.sourceforge.io/doc/index.html oprofile是一系列性能监视工具集,包含operf, opreport, opannotate等工具。它依赖于硬件的”performance counter”。oprofile需要你的linux版本不低于2.6. 阅读详情

下载 http://oprofile.sourceforge.net

yum install popt-devel

yum install binutils

yum install binutils-devel

./configure make make install


operf:

operf -g   -p 13646

如果多个线程区别较大,可加上 -t


opreport:

opreport -l | more

opreport -c   -% -f -g -s sample | more


opannotate:

opannotate -s


Using operf

This section describes in detail how operf is used to control profiling. Unless otherwise directed, operf will profile using the default event for your system. For most systems, the default event is some cycles-based event, assuming your processor type supports hardware performance counters. If your hardware does support performance counters, you can specify something other than the default hardware event on which to profile. The performance monitor counters can be programmed to count various hardware events, such as cache misses or MMX operations. The event chosen for each counter is reflected in the profile data collected by OProfile: functions and binaries at the top of the profiles reflect that most of the chosen events happened within that code.

Additionally, each counter is programmed with a "count" value, which corresponds to how detailed the profile is. The lower the value, the more frequently profile samples are taken. You can choose to sample only kernel code, user-space code, or both (both is the default). Finally, some events have a "unit mask" -- this is a value that further restricts the type of event being counted. You can see the event types and unit masks for your CPU using ophelp. More information on event specification can be found at Section 3, “Specifying performance counter events”.

The operf command syntax is:

operf [ options ] [ --system-wide | --pid=<PID> | [ command [ args ] ] ]

When profiling an application using either the command or --pid option of operf, forks and execs of the profiled process will also be profiled. The samples from an exec'ed process will be attributed to the executable binary run by that process. See Section 7, “Using operf to profile fork/execs”

Following is a description of the operf options.

command [args]

The command or application to be profiled. The [args] are the input arguments that the command or application requires. Either command, --pid or --system-wide is required, but cannot be used simultaneously.

--pid / -p [PID]

This option enables operf to profile a running application. PID should be the process ID of the process you wish to profile. When finished profiling (e.g., when the profiled process ends), press Ctrl-c to stop operf.

--system-wide / -s

This option is for performing a system-wide profile. You must have root authority to run operf in this mode. When finished profiling, Ctrl-C to stop operf. If you run operf --system-wide as a background job (i.e., with the &), you must stop it in a controlled manner in order to process the profile data it has collected. Use kill -SIGINT <operf-PID> for this purpose. It is recommended that when running operf with this option, your current working directory should be /root or a subdirectory of /root to avoid storing sample data files in locations accessible by regular users.

--vmlinux / k [vmlinux_path]

A vmlinux file that matches the running kernel that has symbol and/or debuginfo. Kernel samples will be attributed to this binary, allowing post-processing tools (like opreport) to attribute samples to the appropriate kernel symbols. If this option is not specified, the file /proc/kallsyms is used to obtain kernel symbol addresses correponding to sample addresses. However, the setting of /proc/sys/kernel/kptr_restrict may restrict a non-root user's access to /proc/kallsyms, in which case, all kernel samples are attributed to a pseudo binary named "no-vmlinux".

--callgraph / -g

This option enables the callgraph to be saved during profiling. NOTE: The full callchain is recorded, so there is no depth limit.

--append / -a

By default, operf moves old profile data from <session_dir>/samples/current to <session_dir>/samples/previous. If a 'previous' profile already existed, it will be replaced. If the --append option is passed, old profile data in 'current' is left in place and new profile data will be added to it, and the 'previous' profile (if one existed) will remain untouched. To access the 'previous' profile, simply add a session specification to the normal invocation of oprofile post-processing tools; for example:

opreport session:previous

--events / -e [event1[,event2[,...]]]

This option is for passing a comma-separated list of event specifications for profiling. Each event spec is of the form:

name:count[:unitmask[:kernel[:user]]]

When no event specification is given, the default event for the running processor type will be used for profiling. Use ophelp to list the available events for your processor type.

--separate-thread / -t

This option categorizes samples by thread group ID (tgid) and thread ID (tid). The --separate-thread option is useful for seeing per-thread samples in multi-threaded applications. When used in conjuction with the --system-wide option, --separate-thread is also useful for seeing per-process (i.e., per-thread group) samples for the case where multiple processes are executing the same program during a profiling run.

--separate-cpu / -c

This option categorizes samples by cpu.

--session-dir / -d [path]

This option specifies the session directory to hold the sample data. If not specified, the data is saved in the oprofile_data directory on the current path.

---lazy-conversion / -l

Use this option to reduce the overhead of operf during profiling. Normally, profile data received from the kernel is converted to OProfile format during profiling time. This is typically not an issue when profiling a single application. But when using the --system-wide option, this on-the-fly conversion process can cause noticeable overhead, particularly on busy multi-processor systems. The --lazy-conversion option directs operf to wait until profiling is completed to do the conversion of profile data.

--verbose / -V [level]

A comma-separated list of debugging control values used to increase the verbosity of the output. Valid values are: debug, record, convert, misc, sfile, arcs, and the special value, 'all'.

--version -v

Show operf version.

--help / -h

Show a help message


Options for opreport

--accumulated / -a

Accumulate sample and percentage counts in the symbol list.

--callgraph / -c

Show callgraph information.

--debug-info / -g

Show source file and line for each symbol.

--demangle / -D none|normal|smart

none: no demangling. normal: use default demangler (default) smart: use pattern-matching to make C++ symbol demangling more readable.

--details / -d

Show per-instruction details for all selected symbols. Note that, for binaries without symbol information, the VMA values shown are raw file offsets for the image binary.

--exclude-dependent / -x

Do not include application-specific images for libraries, kernel modules and the kernel..

--exclude-symbols / -e [symbols]

Exclude all the symbols in the given comma-separated list.

--global-percent / -%

Make all percentages relative to the whole profile.

--help / -? / --usage

Show help message.

--image-path / -p [paths]

Comma-separated list of additional paths to search for binaries. This is needed to find kernel modules.

--root / -R [path]

A path to a filesystem to search for additional binaries.

--include-symbols / -i [symbols]

Only include symbols in the given comma-separated list.

--long-filenames / -f

Output full paths instead of basenames.

--merge / -m [lib,cpu,tid,tgid,unitmask,all]

Merge any profiles separated in a --separate session.

--no-header

Don't output a header detailing profiling parameters.

--output-file / -o [file]

Output to the given file instead of stdout.

--reverse-sort / -r

Reverse the sort from the default.

--session-dir=dir_path

Use sample database from the specified directory dir_path instead of the default location. If this option is not specified, then opreport will search for samples in <cur_dir>/oprofile_data first. If that directory does not exist, the standard session-dir of /var/lib/oprofile is used as the session directory.

--show-address / -w

Show the VMA address of each symbol (off by default).

--sort / -s [vma,sample,symbol,debug,image]

Sort the list of symbols by, respectively, symbol address, number of samples, symbol name, debug filename and line number, binary image filename.

--symbols / -l

List per-symbol information instead of a binary image summary.

--threshold / -t [percentage]

Only output data for symbols that have more than the given percentage of total samples. For profiles using multiple events, if the threshold is reached for any event, then all sample data for the symbol is shown.

--verbose / -V [options]

Give verbose debugging output.

--version / -v

Show version.

--xml / -X

Generate XML output.


Usage of opannotate

--assembly / -a

Output annotated assembly. If this is combined with --source, then mixed source / assembly annotations are output.

--base-dirs / -b [paths]/

Comma-separated list of path prefixes. This can be used to point OProfile to a different location for source files when the debug information specifies an absolute path on your system for the source that does not exist. The prefix is stripped from the debug source file paths, then searched in the search dirs specified by --search-dirs.

--demangle / -D none|normal|smart

none: no demangling. normal: use default demangler (default) smart: use pattern-matching to make C++ symbol demangling more readable.

--exclude-dependent / -x

Do not include application-specific images for libraries, kernel modules and the kernel.

--exclude-file [files]

Exclude all files in the given comma-separated list of glob patterns. This option is supported solely with the --source option. It can be used to filter out source files in the output using the following types of specifications:

  • filenames (basename -- i.e., no path)
  • filename glob specifications (all files whose base filename matches the given pattern)
  • directory segments (all source files located in the specified directory; e.g. "libio")
  • directory segment glob specifications (e.g., "libi*")

--exclude-symbols / -e [symbols]

Exclude all the symbols in the given comma-separated list.

--help / -? / --usage

Show help message.

--image-path / -p [paths]

Comma-separated list of additional paths to search for binaries. This is needed to find kernel modules.

--root / -R [path]

A path to a filesystem to search for additional binaries.

--include-file [files]

Only include files in the given comma-separated list of glob patterns. The same rules apply for this option as for the --exclude-file option.

--include-symbols / -i [symbols]

Only include symbols in the given comma-separated list.

--objdump-params [params]

Pass the given parameters as extra values when calling objdump. If more than one option is to be passed to objdump, the parameters must be enclosed in a quoted string.

An example of where this option is useful is when your toolchain does not automatically recognize instructions that are specific to your processor. For example, on IBM POWER7/RHEL 6, objdump must be told that a binary file may have POWER7-specific instructions. The opannotate option to show the POWER7-specific instructions is:

   --objdump-params=-Mpower7

The opannotate option to show the POWER7-specific instructions, the source code (--source) and the line numbers (-l) would be:

   --objdump-params="-Mpower7 -l --source"

--output-dir / -o [dir]

Output directory. This makes opannotate output one annotated file for each source file. This option can't be used in conjunction with --assembly.

--search-dirs / -d [paths]

Comma-separated list of paths to search for source files. This is useful to find source files when the debug information only contains relative paths.

--source / -s

Output annotated source. This requires debugging information to be available for the binaries.

--session-dir=dir_path

Use sample database from the specified directory dir_path instead of the default location. If this option is not specified, then opannotate will search for samples in <cur_dir>/oprofile_data first. If that directory does not exist, the standard session-dir of /var/lib/oprofile is used as the session directory.

--threshold / -t [percentage]

For annotated assembly, only output data for symbols that have more than the given percentage of total samples. For profiles using multiple events, if the threshold is reached for any event, then all sample data for the symbol is shown.

For annotated source, only output data for source files that have more than the given percentage of total samples. For profiles using multiple events, if the threshold is reached for any event, then all sample data for the source file is shown.

--verbose / -V [options]

Give verbose debugging output.

--version / -v

Show version.







使用oprofile 过程 oprofile 从安装到使用具体步骤如下:安装如下:1从http://oprofile.sourceforge.net/download/ 下oprofile的最新版本:oprofile-0.9.6.tar.gz(目前为止)2解压后,在oprofile-0.9.6文件夹中运行 ./configure --with-kernel-support 。在最后会遇到一个问题1:configure: error: liberty library not found解决:yum install binutils-de 阅读详情

相关推荐

oprofile-0.9.8.tar.gz

oProfile是用于Linux的若干种评测和性能监控工具中的一种,它可以工作在不同的体系结构上,包括MIPS、ARM、IA32、IA64和AMD。oProfile包含在Linux2.5和更高版本的内核中,也包含在大多数较新的Linux版本中,包括RedHat9。

linux Ubuntu16.04 oprofile1.1.0 编译笔记

内核支持: .config 文件选项 CONFIG_PROFILING=y   CONFIG_OPROFILE=y  重新编译,替换内核,重启系统 下载源代码: wget http://prdownloads.sourceforge.net/oprofile/oprofile-1.1.0.tar.gz 解压: tar -zxcf  oprofile-1.1.

zuihaobushi的专栏 986

OProfile -- Linux Profiling Tool

linux 强大的性能测试工具的用法 powerful tool and to profile a set of applications to understand the output from OProfile. This is an excellent tool to have in your toolbox.

linux oprofile 手册,Oprofile/operf使用小结

[root@server16 ~]# cat operf.manOPERF(1) General Commands Manual OPERF(1)NAMEoperf - Performance profiler tool for LinuxSYNOPSISoperf [ opt...

weixin_39524425的博客 532

oprofile manual

oprofile 是linux下很长有用的性能分析工具,这个文档是oprofile官方网站提供的manual的pdf版

oprofile 移植

oprofile 移植到板端 oprofile 移植

优化嵌入式Linux的启动时间之工具链/应用程序优化

欢迎关注公众号,文章会同步发布在嵌入式客栈 导读:嵌入式Linux在应用中往往希望系统能在尽量短的时间内启动,以提高用户体验。而且在有的应用场合,对启动时间具有严格的时间要求,尤其在工业或者医疗器械应用领域。此时如何加快Linux的启动,将成为一个挑战,对于大多数应用开发人员而言,由于Linux系统的复杂性,对于如何提高启动速度,往往无从下手。那么阅读完本文,将获得清晰完整的解决思路。 1.降低...

嵌入式客栈 920

WPF MVVM实战:构建可绑定的RichTextBox富文本编辑器

本文详细介绍了如何在WPF MVVM模式下构建可绑定的RichTextBox富文本编辑器,解决标准RichTextBox.Document属性不支持数据绑定的问题。通过创建自定义BindableRichTextBox控件,实现FlowDocument的绑定支持,并分享插入图片、文本格式控制等实战技巧,帮助开发者高效开发富文本编辑功能。

weixin_33717117的博客 309

OProfile入门——安装篇

参考博文: http://blog.csdn.net/luckywang1103/article/details/44087325 http://blog.csdn.net/lgh2008/article/details/1831184 1. 准备工作 (1)下载OProfile: 下载地址:https://sourceforge.net/projects/oprofile/fi

u013718481的博客 1409

反激开关电源变压器设计实例讲解(定明芳)

内容来自《反激变压器的设计》(定明芳主讲)。 定名芳老师主要讲了10步,最后应该还有一步,线径的选择已经绕制方式。这里进行了记录整理,把一些公式来源进行了推导。所有的设计都是基于理论计算。 1.确定电源规格 2.确定工作频率和最大占空比 3.计算匝比(利用伏秒平衡原则) 此处插入解释一下伏秒平衡,根源是磁通量平衡。该原则可以用来检查MOS管耐压是否够。 4.计算初级线圈峰值电流 基于CCM模式计算的。ip1是开关管要关闭时的峰值电流,ip2是开关管开始导通时的起始电流。因为时CCM模式,所以,ip

ydgd118的博客 5万+

OS实验xv6 6.S081 开坑

OS实验xv6 6.S081 开坑 终于把xv6 2019 6.S081做完了,网络部分没有写,因为有计网实验了。怎么说呢,xv6的坑有点多,能做完多亏了:和我同学ljj交流,参考RedemptionC老哥的博客(他写的非常详细,遗憾的是,他好像没有写mmap),再者就是参考这位老哥的做法(没有源码,写得不是特别详细,不过有借鉴作用,mmap就是借鉴了他的思想)……废话不多说了,直接开始。 实验指导 首推RedemptionC的博客 这位老哥的个人博客 xv6 6.S081官网(后面的实验都要参考官网

不定期更新系统使用、编程小技巧,哔哩哔哩账号:https://space.bilibili.com/399455629,欢迎关注 4506

Oprofile性能分析工具

OProfile介绍 OProfile是Linux系统的性能分析工具,是一个开源的profiling工具,使用性能计数器来统计信息,能够以非常低的代价剖析程序性能,而且可以对内核进行profiling。它统计的信息非常的多,可以得到cache的缺失率,memory的访存信息,分支预测错误率等。主要支持x86、power处理器,已经移植到龙芯系列处理器,包括龙芯2F、龙芯3A、龙芯3B等。OPro

yarsen的专栏 1824

Seedance2.5本地部署指南:从环境配置到生产优化的完整实践

在 AI 内容生成领域,本地部署方案正逐渐成为开发者和技术团队关注的焦点。Seedance2.5 作为一款支持图像和视频生成的 AI 工具,其完全离线运行的能力解决了云端服务在数据隐私、使用成本和访问稳定性方面的痛点。对于需要处理敏感内容、频繁生成素材或希望完全掌控生成流程的技术人员来说,掌握本地部署方法具有实际价值。 本文将以 Seedance2.5 的本地部署为例,详细介绍从环境准备、依赖配置到运行验证的完整流程,同时深入分析关键参数配置、常见问题排查方法以及生产环境下的优化建议。通过实际部署过程,理解

weixin_33139275的博客 790

性能测试:oprofile的学习使用

一、oprofile简介 Oprofile是linux上的性能监测工具,有人说是性能测试的神器。通过CPU硬件提供的性能计数器对事件进行采样,从代码层面分析程序的性能消耗情况,找出程序性能的问题点。 oProfile是Linux平台上的一个功能强大的性能分析工具,支持两种采样(sampling)方式:基于事件的采样(eventbased)和基于时间的采样(timebased)。 基...

weixin_30849591的博客 1234

abaqus wcm插件下载_Abaqus随机短纤维增强复合材料建模插件

文末附Abaqus随机短纤维增强复合材料建模插件下载链接前言短纤维增强复合材料相对于长纤维增强复合材料来说更容易制备,且短纤维的填充性能略有改善,可制造复杂产品,广泛应用于车辆、航空航天、建筑等行业,对短纤维增强复合材料进行细观力学分析,可对其宏观力学性能进行预测、分析破坏机理等。接下来对随机短纤维增强复合材料建模插件进行介绍。NO.1 【算法简介】难点一:此插件核心在于判断生成的纤维是...

weixin_39974882的博客 2839

用Python和NumPy可视化理解波函数:从概率密度到薛定谔方程的可视化教程

本文通过Python和NumPy实现量子力学波函数的可视化,从概率密度到薛定谔方程的动态演化,帮助读者直观理解量子态的特性。教程涵盖无限深势阱、量子谐振子等模型,结合代码示例展示时间演化和期望值计算,为量子力学学习提供实用工具。

weixin_27303545的博客 231

oProfile的安装与使用

0.引言 基于DPDK的发包工具的性能今天已经达到双向1900Wpps了,比昨天又高了200Wpps,正是得益于oProfile检测与调优的结果,而且今天还只是很简单的用了一下(类似于下面的示例),跟踪出对几个结构体字段的访问比较缓慢,于是对结构体字段进行了仔细的顺序调整与Cache对齐(之前急于功能实现,没顾及这些字段的排布),结果性能马上飙升了200Wpps,开心死我了。后天(明天外出办理其

u013920085的专栏 1974

面向业务角色的 SAP Fiori Space 与 Page 创建全流程实战指南

业务角色导航设计:从Space与Page规划到实施 摘要:本文探讨了SAP S/4HANA Cloud和BTP ABAP环境中基于业务角色的导航设计方法。传统Fiori Launchpad的Group+Tile模式存在应用堆积问题,而新的Space与Page模型将导航按工作领域(如应付会计、销售代表)组织,每个Space包含多个任务导向的Page。文章详细介绍了从业务角色建模到Space/Page创建、分配的完整流程,包括核心概念解析、规划思路和具体操作步骤。重点阐述了如何根据业务需求选择创建方式(基于预交

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 191

初次使用oprofile

早就想试试oprofile,这几天简单的试了一下最基本的功能。 由于条件限制只能在虚拟机上实验。   1. 下载oprofile工具,加压后编译,安装 ./configure --with-kernel-support make make install   2. 加载模块 insmod /lib/modules/kernel/xxx/arch

moon146的专栏 769

【异常】Codybuddy Error Code: 14003 too many requests 限流报错问题排查与解决指南

14003报错本质为服务端限流拦截,并非账号封禁或程序致命故障,90%以上的场景可通过等待冷却+规范使用行为解决。通过本文的排查步骤,可快速恢复工具使用,同时规避后续重复触发该问题。

奶爸的编程之路,也就一周冷个三天 1266

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

linux oprofile 手册,OProfile 使用指南

OProfile使用指南by chenny7@163.com,updated on 2Nov. 2012.1、PrinciplesOProfile主要是通过采样,利用CPU上的性能计数器(perfomance counter)统计某些事件的发生次数。它由内核模块和用户空间守护进程两部分组成,前者可以访问性能计数器,后者则负责从性能计数器收集数据。OProfile有两种采样方式:基于事件的采样(pe...

weixin_42123456的博客 733

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

在龙芯1B上使用oprofile

原文地址:1B上使用oprofile">在loongson 1B上使用oprofile作者:sense00661.下载Oprofile源码 # git clone git://git.printk.org/caiwanwei/oprofile-0.9.7   (里面有对loongson 系统 cpu 的支持) 2.编译Oprofile(可以在x86的机器上编译,这里为是省去编译依赖库的问题选择在2

AmyDaddy的专栏 1050

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

oprofile

OProfile的原理比较简单:现在的很多CPU都提供一个所谓性能计数器的东西(performance counter),大致的原理就是程序可以注册告诉CPU对什么event感兴趣(比如CPU_CYCLE,CPU经历了一次时钟周期),然后CPU在执行了相应的操作后,就会在性能计数器上加1,这样程序就可以取出。所以,使用OProfile来定位CPU使用率的问题,就变成了让oprofile收集程序运行

zcfriends的专栏 1312

OProfile在Andorid上使用

OProfile作为一个Linux的工具,可以分析kernel和应用的性能。因此如何将OProfile应用于Android对于发现并解决Android的性能具有很重要的意义。本文以下将介绍如何在Android上应用OProfile。

Sunny的小窝 5269

linux oprofile 手册,oprofile使用简介

Oprofile使用1 介绍Oprofile是linux上的性能监测工具,通过CPU硬件提供的性能计数器对事件进行采样,从代码层面分析程序的性能消耗情况,找出程序性能的问题点。2 oprofile安装RHEL6.8GA上直接提供了安装包,配置好yum源直接安装即可。yum install oprofile3 oprofile使用设置检测事件opcontrol --event=::::各字段含义如下...

weixin_31616803的博客 1270
上一篇: postgresql9.6中的 Row Security Policies
下一篇: gperftools-2.5.93
spche
博客等级 码龄22年 36粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值