Debian系列通过top查看进程绑定的CPU_ID

debian系列与rhel系列有些地方差别还是挺大的,rhel里直接top,f,j,回车,即可看到所有进程所在的cpu id,ubuntu里找了找,也是可以做到的

 

当然如果不想用top来看,通过ps命令也是可以找的

lihui@2015-vm1:~$ pgrep mysql
2209


lihui@2015-vm1:~$ ps -eo pid,psr | grep 2209
  2209   1

 

如果直接看top,可以进行如下操作
top

f

看到了P       = Last Used Cpu (SMP) 这行,光标移到这里,然后回车或者d

q保存退出,就会在屏幕的最右边看到P那列的数字,就是cpu的core id

Tasks: 504 total,   2 running, 502 sleeping,   0 stopped,   0 zombie
%Cpu0  : 24.7 us,  8.4 sy,  0.0 ni, 66.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  : 30.8 us, 10.8 sy,  0.0 ni, 58.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu2  : 31.2 us,  8.5 sy,  0.0 ni, 60.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   3947716 total,  1973232 used,  1974484 free,    42020 buffers
KiB Swap:        0 total,        0 used,        0 free.   281624 cached Mem
PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                P
3527 root      20   0  227308  65716   8816 S   8.3  1.7   0:39.65 python                                                                                 0
3520 root      20   0  114456  43288   7768 S   3.5  1.1   0:11.01 python                                                                                 2
16836 root      20   0   42124  13780   6636 R   1.6  0.3   0:00.04 neutron-rootwra                                                                        2
9 root      20   0       0      0      0 S   1.2  0.0   0:02.82 rcuos/1                                                                                0
3505 root      20   0  118628  44096   9848 S   1.2  1.1   0:04.66 python                                                                                 0
3511 root      20   0  166892  77848  10080 S   1.2  2.0   0:05.83 nova-api                                                                               0
3522 root      20   0  137232  52568   9820 S   1.2  1.3   0:04.97 python                                                                                 0
7 root      20   0       0      0      0 S   0.8  0.0   0:03.75 rcu_sched                                                                              0
8 root      20   0       0      0      0 S   0.8  0.0   0:02.91 rcuos/0                                                                                1
10 root      20   0       0      0      0 S   0.8  0.0   0:03.16 rcuos/2                                                                                1
820 syslog    20   0  255848   4764   2484 S   0.8  0.1   0:01.65 rsyslogd                                                                               2
1281 root      10 -10   21424   4716   3800 S   0.8  0.1   0:01.48 ovsdb-server                                                                           2
2327 rabbitmq  20   0 1745196 111588   4056 S   0.8  2.8   0:15.25 beam.smp                                                                               0
3492 root      20   0   94456  29320   7280 S   0.8  0.7   0:04.32 python                                                                                 0
265 root      rt   0       0      0      0 S   0.4  0.0   0:00.15 migration/0                                                                            0
293 root      20   0       0      0      0 S   0.4  0.0   0:02.01 kworker/0:1                                                                            0
2209 mysql     20   0 1536300  83212  10792 S   0.4  2.1   0:05.28 mysqld                                                                                 1
2963 root      20   0       0      0      0 S   0.4  0.0   0:00.48 kworker/1:0                                                                            1
3503 root      20   0  332276  46020   8504 S   0.4  1.2   0:02.59 python                                                                                 2
3525 root      20   0  114212  42688   7616 S   0.4  1.1   0:01.58 python                                                                                 2
3529 root      20   0  136948  39740   9848 S   0.4  1.0   0:00.85 nova-novncproxy                                                                        2
16491 lihui     20   0   23940   3300   2468 R   0.4  0.1   0:00.03 top                                                                                    1
1 root      20   0   33792   4308   2632 S   0.0  0.1   0:03.12 init                                                                                   1
2 root      20   0       0      0      0 S   0.0  0.0   0:00.07 kthreadd                                                                               2
3 root      20   0       0      0      0 S   0.0  0.0   0:00.11 ksoftirqd/0                                                                            0
5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                                                                           0
11 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/3                                                                                1
12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/4                                                                                0
13 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/5                                                                                0
14 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/6                                                                                0
15 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/7                                                                                0

发表评论