安装perf工具

碰到CPU占用100%的问题,需要perf工具来分析,参考文章来编译perf工具(不能通过apt安装,因为源里面没有包含)

https://blog.csdn.net/nigaoshang/article/details/127276275

获取Jetpack版本

jetson_release -v
oftware part of jetson-stats 4.2.4 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin - Jetpack 5.1 [L4T 35.2.1]
NV Power Mode[0]: MAXN
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - 699-level Part Number: 699-13701-0005-500 R.0
 - P-Number: p3701-0005
 - Module: NVIDIA Jetson AGX Orin (64GB ram)
 - SoC: tegra23x
 - CUDA Arch BIN: 8.7
 - Codename: Concord
Platform:
 - Machine: aarch64
 - System: Linux
 - Distribution: Ubuntu 20.04 focal
 - Release: 5.10.104-tegra
 - Python: 3.8.10
jtop:
 - Version: 4.2.4
 - Service: Active
Libraries:
 - CUDA: Not installed
 - cuDNN: Not installed
 - TensorRT: Not installed
 - VPI: Not installed
 - Vulkan: 1.3.204
 - OpenCV: 4.5.4 - with CUDA: NO

Jetpack 5.1 [L4T 35.2.1] 为当前版本

https://developer.nvidia.com/embedded/jetpack-archive 寻找对应的Jetpack版本,我的是 https://developer.nvidia.com/embedded/jetson-linux-r3521

下载源代码包 https://developer.nvidia.com/downloads/public-sourcestbz2

安装编译依赖库(很重要,不然perf会运行崩溃出现double free问题)

sudo apt install libunwind-dev
sudo apt install libdwarf-dev
sudo apt install libelf-dev
sudo apt install libcap-dev
sudo apt install libdw-dev

编译

tar -xjvf public_sources.tbz2 # 解压
cd Linux_for_Tegra/source/public # 进入目录
tar -xjvf kernel_src.tbz2 # 解压内核源码
cd kernel/kernel-5.10 # 进入内核源码目录
cd tools/perf # 进入perf目录
make # 编译perf
sudo cp perf /usr/bin/ # 拷贝perf到系统目录

运行

sudo perf top