1、安装psttree命令
yum -y install psmisc
2、使用top和pidstat
# 间隔1秒输出一组数据(按Ctrl+C结束)
$ pidstat 1
top
3、若发现top无法找到占用CPU的进程,可使用pstree查看可疑进程
$ pstree | grep stress
|-docker-containe-+-php-fpm-+-php-fpm---sh---stress
| |-3*[php-fpm---sh---stress---stress]
4、使用perf查看报告
# 记录性能事件,等待大约15秒后按 Ctrl+C 退出
$ perf record -g
# 查看报告
$ perf report
5、使用execsnoop发现短时进程的基本信息
https://github.com/brendangregg/perf-tools
# 按 Ctrl+C 结束
$ execsnoop
PCOMM PID PPID RET ARGS
sh 30394 30393 0
stress 30396 30394 0 /usr/local/bin/stress -t 1 -d 1
sh 30398 30393 0
stress 30399 30398 0 /usr/local/bin/stress -t 1 -d 1
sh 30402 30400 0
stress 30403 30402 0 /usr/local/bin/stress -t 1 -d 1
sh 30405 30393 0
stress 30407 30405 0 /usr/local/bin/stress -t 1 -d 1
...