当前位置:网站首页>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
边栏推荐
- 【3】 DEM mountain shadow effect
- 2022.07.24(LC_6125_相等行列对)
- Zuul gateway use
- 启牛开的证券账户安全吗?是怎么开账户的
- 阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?
- MySQL练习二
- 基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
- R language uses LM function to build multiple linear regression model, step function to build forward stepwise regression model to screen the best subset of prediction variables, and scope parameter t
- Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告
- Pytorch project practice - fashionmnist fashion classification
猜你喜欢

Fault tolerant mechanism record

2022.07.24(LC_6124_第一个出现两次的字母)

Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network

2022.07.24(LC_6125_相等行列对)

Feign use

【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12
![[advanced C language] dynamic memory management](/img/b7/6586b35500eb8f39a3ea8c125fb572.png)
[advanced C language] dynamic memory management

PyTorch进阶训练技巧

If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing

Atomic atomic class
随机推荐
【九】坐标格网添加以及调整
R language uses the ggarrange function of ggpubr package to combine multiple images, and uses the ggexport function to save the visual images in JPEG format (width parameter specifies width, height pa
R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin graph, set the add parameter to add jitter data points and mean standard deviation vertical bars (
JS 将伪数组转换成数组
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
[shutter -- layout] stacked layout (stack and positioned)
【四】布局视图和布局工具条使用
Ecological profile of pytorch
perf 性能调试
Build a series of vision transformer practices, and finally meet, Timm library!
水博士2
R language ggpubr package ggarrange function combines multiple images and annotates_ Figure function adds annotation, annotation and annotation information for the combined image, adds image labels fo
【10】 Scale bar addition and adjustment
Does MySQL have flush privileges
【七】图层显示和标注
The first scratch crawler
More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural
Location analysis of recording an online deadlock
Pytorch visualization
919. 完全二叉树插入器 : 简单 BFS 运用题