当前位置:网站首页>Perf performance debugging
Perf performance debugging
2022-07-25 12:37:00 【mightbxg】
perf yes linux One of the system debugging tools , It can be sampled at a certain frequency ( Default 4000Hz) Monitor the operation of functions in the specified process , So as to analyze the performance bottleneck of the program , And then targeted optimization .
Tool installation
perf Not at all linux The system comes with it by default , Need to install linux-tools Toolset , such as :
sudo apt install linux-tools-common linux-tools-generic linux-tools-`uname -r`
Or compile it from the source code :
sudo apt install build-essential git flex bison
git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux/tools/perf
make
sudo cp perf /usr/bin
If your system kernel has been upgraded by yourself , Then you can only compile from the source code , because apt The source only has the default kernel of the current system linux-tools-xxx
perf Usage method
First, you need to run the tested program , And get its PID, Suppose the program name is my_awesome_app, Then get PID The order is :
MY_PID=$(ps -ef | grep my_awesome_app | grep -v 'grep' | awk '{print $2}')
Then start perf monitoring :
perf record -F 4000 -g -p $MY_PID -- sleep 80
among -F <freq> Specify the sampling frequency ,-g It means recording function call stack ,-p <PID> Specify monitored PID,-- sleep <secs> Specify the monitoring duration , Please check perf record --help
perf After monitoring, it will be generated in the current path perf.data file , perform perf report -n --stdio Will read perf.data And display the results on the terminal .
Flame chart
perf report Analyzing performance is still inconvenient , It can be converted into a flame diagram to view , Tools to address :FlameGraph, The specific usage has been clearly written in the warehouse .
Reference material
边栏推荐
- Dr. water 2
- WPF项目入门1-简单登录页面的设计和开发
- 2022.07.24(LC_6125_相等行列对)
- 【4】 Layout view and layout toolbar usage
- 2022河南萌新联赛第(三)场:河南大学 I - 旅行
- If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
- Intval MD5 bypass [wustctf2020] plain
- Numpy first acquaintance
- Resttemplate and ribbon are easy to use
- Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?
猜你喜欢

弹性盒子(Flex Box)详解

A method to prevent SYN flooding attacks -- syn cookies

PyTorch进阶训练技巧

2022.07.24(LC_6126_设计食物评分系统)

Eureka registration center opens password authentication - record

After having a meal with trump, I wrote this article

Build a series of vision transformer practices, and finally meet, Timm library!

水博士2

Use of hystrix
![[ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro](/img/a2/9b676d0f1b33cc7d413cee6c52d76d.png)
[ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro
随机推荐
Script set random user_ agent
【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12
SSTI 模板注入漏洞总结之[BJDCTF2020]Cookie is so stable
Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告
通信总线协议一 :UART
想要做好软件测试,可以先了解AST、SCA和渗透测试
Basic concepts of NLP 1
numpy初识
Table partition of MySQL
Crawler crawls dynamic website
Cmake learning notes (II) generation and use of Library
Implement anti-theft chain through referer request header
想要白嫖正则大全是吧?这一次给你个够!
【4】 Layout view and layout toolbar usage
PyTorch进阶训练技巧
How to access DMS database remotely? What is the IP address? What is the user name?
论文解读(MaskGAE)《MaskGAE: Masked Graph Modeling Meets Graph Autoencoders》
Feign use
Is the securities account opened by qiniu safe? How to open an account
Excuse me, using data integration to import data from PostgreSQL to MySQL database, emoj appears in some data fields