Skip to content

Commit a240d9f

Browse files
add perf
1 parent d50c55d commit a240d9f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

note/linux命令.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ pidstat -u 1 # 每秒1次的频率输出
427427
428428
### netstat
429429
430+
我经常用的就是
431+
```
432+
netstat -atunlp
433+
```
434+
430435
### strace
431436
432437
跟踪系统运行的过程中,执行的系统调用和信号。这个简直就是debug的神器呀。
@@ -456,13 +461,18 @@ accept(3,
456461
457462
说明程序阻塞在了accept上面。当然,这个用gdb也可以实现。
458463
459-
### perf命令
464+
### perf
460465
461-
分析性能问题的一个神器。
466+
分析性能问题的一个神器。
467+
468+
```
469+
# -g 参数表示记录
470+
sudo perf top -g -p pid
471+
```
462472
463-
perf top
473+
从perf的输出可以看出,在那些函数执行的时间是比较长的,这样可以帮助对性能问题,进行相关的分析。
464474
465-
perf record
475+
![](../pic/perf.png)
466476
467477
### nc
468478

pic/perf.png

38.5 KB
Loading

0 commit comments

Comments
 (0)