通常我们可以通过top命令查看各个进程占用的资源,按1即可查看各个CORE的忙碌情况,假如想看看多线程程序各个线程的资源情况
1:top
2:输入大写H
3:回车
就可以得到下面内容,然后可以f,j回车,甚至连每个线程绑定的cpu core也能打印出来,爽歪歪~!
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ P COMMAND
24640 root 20 0 7351m 7.0g 128m R 100.0 22.3 541:42.68 11 lihui_tcp
24642 root 20 0 7351m 7.0g 128m R 100.0 22.3 541:41.52 7 lihui_tcp
24644 root 20 0 7351m 7.0g 128m R 100.0 22.3 541:41.54 9 lihui_tcp
24645 root 20 0 7351m 7.0g 128m R 100.0 22.3 541:43.28 10 lihui_tcp
24641 root 20 0 7351m 7.0g 128m R 99.6 22.3 541:41.34 6 lihui_tcp
24643 root 20 0 7351m 7.0g 128m R 99.6 22.3 541:41.54 8 lihui_tcp
5612 juyun 20 0 1806m 1.0g 3672 S 28.2 3.3 405:43.78 1 nfcapd
5642 juyun 20 0 1806m 1.0g 3672 S 24.6 3.3 369:50.22 5 nfcapd
5641 juyun 20 0 1806m 1.0g 3672 S 16.3 3.3 253:11.61 3 nfcapd
10415 root 20 0 0 0 0 S 0.7 0.0 19:07.68 0 flush-253:2