| 场景 | 多线程进程内部热点定位 |
|---|---|
| 组合 | top -H + ps -L + 栈工具对应 |
线程排行
线程排行
top -H -b -n1 | head -20 # 全系统线程视图
ps -L -p 1234 -o pid,tid,pcpu,stat,comm --sort=-pcpu | headJava 对应
Java 对应
# TID 转十六进制与 jstack 输出对齐:
printf '%x\n' 12345
jstack 1234 | grep -A20 'nid=0x3039'Go 对应
Go 对应
kill -QUIT 1234 # SIGQUIT 打全量 goroutine 栈到 stderr/日志
# 或访问 pprof:curl -s http://127.0.0.1:6060/debug/pprof/profile?seconds=30 > cpu.pprof