linux-查看进程对应的线程

2020-06-29  本文已影响0人  与诗小睡
  1. PS
[root@master ~]# ps -T -p 3
    PID    SPID TTY          TIME CMD
      3       3 ?        00:00:00 rcu_gp
[root@master ~]# 

SID”栏表示线程ID,而“CMD”栏则显示了线程名称。

  1. Top
top -H
top - 04:26:18 up  3:27,  1 user,  load average: 0.82, 0.64, 0.53
Threads: 592 total,   4 running, 588 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.0 us,  3.0 sy,  0.0 ni, 94.0 id,  0.0 wa,  1.4 hi,  0.6 si,  0.0 st
MiB Mem :   3752.0 total,   1558.7 free,   1268.0 used,    925.3 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   2372.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                              
   3053 root      20   0  689892 559640  72224 R   2.3  14.6   4:21.44 kube-apiserver                                                                                                       
   3055 root      20   0  689892 559640  72224 R   1.3  14.6   2:14.14 kube-apiserver                                                                                                       
 295563 root      20   0  274828   5288   4088 R   1.3   0.1   0:01.62 top                                                                                                                  
   3113 root      20   0  689892 559640  72224 S   1.0  14.6   2:18.52 kube-apiserver                                                                                                       
   3114 root      20   0  689892 559640  72224 S   1.0  14.6   2:39.96 kube-apiserver                                                                                                       
  13968 root      20   0  689892 559640  72224 S   1.0  14.6   2:06.62 kube-apiserver                                                                                                       
 144827 root      20   0  689892 559640  72224 S   1.0  14.6   1:04.21 kube-apiserver                                                                                                       
   4731 root      20   0  143536  39528  24528 S   1.0   1.0   0:45.19 calico-node                                                                                                          
   5017 root      20   0  143536  39528  24528 S   1.0   1.0   0:41.55 calico-node                                                                                                          
   1507 root      20   0 1794580 119512  62840 S   0.7   3.1   0:54.72 kubelet                                                                                                              
   3056 root      20   0  689892 559640  72224 S   0.7  14.6   2:31.25 kube-apiserver                                                                                                       
   3110 root      20   0  689892 559640  72224 R   0.7  14.6   1:57.82 kube-apiserver                                                                                                       
   3027 root      20   0   10.1g  95980  28556 S   0.7   2.5   1:05.63 etcd                                                                                                                 
  10324 root      20   0   10.1g  95980  28556 S   0.7   2.5   0:35.63 etcd                                                                                                                 
   3040 root      20   0  222596 119248  60832 S   0.7   3.1   1:21.84 kube-controller                                                                                                      
   3042 root      20   0  222596 119248  60832 S   0.7   3.1   0:37.25 kube-controller                                                                                                      
   4725 root      20   0  143536  39528  24528 S   0.7   1.0   2:05.43 calico-node                                                                                                          
   4738 root      20   0  143536  39528  24528 S   0.7   1.0   0:43.83 calico-node                                                                                                          
     10 root      20   0       0      0      0 I   0.3   0.0   0:26.07 rcu_sched 

要让top输出某个特定进程<pid>并检查该进程内运行的线程状况:

[root@master ~]# top -H -p 1
  1. Htop

要在htop中启用线程查看,请开启htop,然后按<F2>来进入htop的设置菜单。选择“设置”栏下面的“显示选项”,然后开启“树状视图”和“显示自定义线程名”选项。按<F10>退出设置。

上一篇下一篇

猜你喜欢

热点阅读