A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

perf 火焰图
-bash/zsh: tc: command not found #Debian apt-get install perf #Ubuntu apt-get install perf #Arch Linux pacman -S perf #Kali Linux apt-get install perf #CentOS yum install perf #Fedora dnf install perf #Raspbian apt-get install perf
perf 是 Linux 下的一款性能分析工具,能够进行函数级与指令级的热点查找。它由一个叫 Performance counters 的内核子系统实现,基于事件采样原理,以性能事件为基础,支持针对处理器相关性能指标与操作系统相关性能指标的性能剖析,可用于性能瓶颈的查找与热点代码的定位。
perf [--version] [--help] COMMAND [ARGS]
-h, --help
Run perf help command.
-v, --version
Display perf version.
-vv
Print the compiled-in status of libraries.
--exec-path
Display or set exec path.
--html-path
Display html documentation path.
-p, --paginate
Set up pager.
--no-pager
Do not set pager.
--buildid-dir
Setup buildid cache directory. It has higher priority than buildid.dir config file option.
--list-cmds
List the most commonly used perf commands.
--list-opts
List available perf options.
--debugfs-dir
Set debugfs directory or set environment variable PERF_DEBUGFS_DIR.
--debug
Setup debug variable (see list below) in value range (0, 10). Use like: --debug verbose # sets verbose = 1 --debug verbose=2 # sets verbose = 2
List of debug variables allowed to set:
verbose - general debug messages
ordered-events - ordered events object debug messages
data-convert - data convert command debug messages
stderr - write debug output (option -v) to stderr
in browser mode
perf-event-open - Print perf_event_open() arguments and
return value
perf list: 查看当前软硬件环境支持的性能事件 perf stat: 分析指定程序的性能概况 perf top: 实时显示系统/进程的性能统计信息 perf record:记录一段时间内系统/进程的性能事件perf report:读取perf record生成的perf.data文件,并显示分析数据
perf 显示命令的基本性能计数器统计信息:
perf stat gcc hello.c
perf 显示系统范围的实时性能计数器配置文件:
sudo perf top
perf 运行命令并将其配置文件记录到“perf.data”中:
sudo perf record command
perf 阅读 perf.data - 由 perf record 创建,并显示配置文件:
sudo perf report