当前位置:网站首页>Performance optimization analysis tool | perf
Performance optimization analysis tool | perf
2022-07-29 10:16:00 【zuhan_ twenty million two hundred and ten thousand three hundre】
perf brief introduction
Perf(Performance Event) yes Linux 2.6.31 Built in performance analysis tool , Compared with others Prof The biggest advantage of the tool lies in its connection with Linux Kernel Close combination , It can analyze the performance of kernel and even hardware . Through it , Applications can take advantage of PMU(Performance Monitor Unit)、tracepoint The performance of the kernel and the special counters , It can not only analyze the performance problems of specified applications , You can also analyze the performance problems of the kernel , Thus, we can fully understand the performance bottlenecks in the application .
perf Compile configuration and installation
stay Linux Compile and install in the kernel source code :
#cd Root directory of kernel source code
#cd tools/perf/
#make && make install
#cp perf target_filesystem/bin/
Kernel configuration requirements
- performance Options
General Setup ->
Kernel Performance Events And Counters ->
[*]Kernel performance events and counters
Kernel configuration options : PERF_EVENTS [=y] - profile Options
General Setup ->
[*]Profiling support
Kernel configuration options : PROFILING [=y] - drivers Options
Device Drivers->
Performance monitor support->
[*]ARM PMU framework
Kernel configuration options :ARM PMU framework[=y] - Device tree pmu Node requirements
edit ft2000plus.dts, stay / Add under node pmu node :
pmu {
compatible = “arm,armv8-pmuv3”;
interrupts = <1 7 4>;
};
explain :PMU(Performance Monitoring Unit) It's all CPU Manufacturer with CPU Hardware provided , It allows software to target certain CPU Hardware events ( Such as cache miss, branch-misses, instructions) Set up counter, And count the number of this event , When the number reaches counter After value , The interrupt . Software inspects by capturing these interrupts CPU usage .
perf Common commands
perf stat
perf stat Is used to run instructions , And analyze the statistical results , The information of the whole life cycle of application can be completely counted .
The command format is :perf stat [ options] [command]
tat means statistic or counting.
In fact, it's statistics 、 Count .
Common options :
• -a: counting for entire system.
• -I: Print count deltas every N milliseconds (minimum: 1ms)
• -C: Appoint core.
perf top
Display the occupation of each function cpu The proportion .
perf record
perf record It is used to record more granular statistical information , And save to file . For example, you can record statistics at the level of a single function ,
And use perf report To display the statistics .
The command format is :perf record [options] [command]
or perf record [options] – command [options]
• -F: Sampling frequency , adopt -F To specify the
• -c :Event period to sample.
• -g: Record function call stack
perf report
perf report Yes, it will perf record The generated file is parsed and displayed . The result is similar to perf top Real time display of .
The command format is :perf report [options]
to perf record Generated perf.data Data display .
Some commands used for debugging in the project
1、
perf stat -r 5 -e cache-misses,cache-references,instructions,cycles,L1-dcache-stores,L1-dcache-store-misses -C 8
2、
perf record -e cache-misses -C 83、
perf top -C 8perf top -g -C 8
Reference link
Video link : https://www.bilibili.com/video/BV1hK4y1A7U4?spm_id_from=333.337.search-card.all.click&vd_source=9a8a120f260b2f6555d727c9d48cf27d
perf Related information :
link :https://pan.baidu.com/s/15ER6N3azPm0cv1i0mG1QkQ
Extraction code :lbqq
边栏推荐
- MySQL optimization theory study guide
- Consumer electronics, frozen to death in summer
- CS research assurance experience in 2021 (VI): system filling + some thoughts
- How to customize the opportunity closing form in dynamics 365online
- Print out the "hourglass" and the remaining number according to the given number of characters and characters
- [paper reading] q-bert: Hessian based ultra low precision quantification of Bert
- Knowledge points of common interview questions: distributed lock
- 【微信小程序】接口生成自定义首页二维码
- Efficient 7 habit learning notes
- Network picture to local picture - default value or shortcut key
猜你喜欢
The latest translated official pytorch easy introduction tutorial (pytorch version 1.0)
转转push的演化之路
How can Plato obtain premium income through elephant swap in a bear market?
通俗易懂讲解梯度下降法!
全面、详细的SQL学习指南(MySQL方向)
Intel joins hands with datawhale to launch learning projects!
Implementation and verification logic of complex expression input component
Hanyuan high tech Gigabit 2-optical 6-conductor rail managed Industrial Ethernet switch supports X-ring redundant ring network one key ring network switch
【黑马早报】每日优鲜回应解散,多地已无法下单;李斌称蔚来将每年出一部手机;李嘉诚欲抄底恒大香港总部大楼;今年国庆休7天上7天...
Read Plato farm's eplato and the reason for its high premium
随机推荐
The purpose of DDD to divide domains, sub domains, core domains, and support domains
After E-sports enters Asia, will Tencent be the next "NBA game catcher"?
[paper reading] i-bert: integer only Bert quantification
[configuration related]
汉源高科千兆2光6电导轨式网管型工业级以太网交换机支持X-Ring冗余环网一键环网交换机
PDF处理还收费?不可能
Intel joins hands with datawhale to launch learning projects!
How to customize the opportunity closing form in dynamics 365online
Shell notes (super complete)
remap_ Use of table in impdp
Examples of specific usage of diagnostic instructions in s7-1200 and s7-1500 (led+devicestates+modulestates)
Tips of Day1 practice in 2022cuda summer training camp
Unity3d empty package APK error summary
10 suggestions for 10x improvement of application performance
Enterprise architecture | togaf architecture capability framework
There is still a chance
【配置相关】
Selenium series 5-xpath path expression
数据可视化的利器-Seaborn简易入门
Meituan senior technical expert: DDD's practice in the evolution of tourism e-commerce architecture