4

Here is my cpu part of info(omitted unnecessary).

cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 60
model name  : Intel(R) Celeron(R) CPU G1840 @ 2.80GHz
stepping    : 3
microcode   : 0x19
cpu MHz     : 2800.000
cache size  : 2048 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2

There two cpus in my pc.
top command can display cpus usage as a whole.
How to display cpu1 usage and cpu2 usage respectively?

5

You can toggle 'single CPU' mode inside top by hitting the 1 key. From man top:

       Summary-Area-defaults
          l - Load Avg/Uptime  On  (thus program name)
          t - Task/Cpu states  On  (1+1 lines, see `1')
          m - Mem/Swap usage   On  (2 lines worth)
          1 - Single Cpu       Off (thus multiple cpus)

For example, with single CPU 'on' (the default, apparently):

top - 22:42:17 up 1 day,  1:11,  1 user,  load average: 0.04, 0.05, 0.20
Tasks: 225 total,   1 running, 224 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.8 us,  0.7 sy,  0.0 ni, 98.3 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3936368 total,   293968 free,  2812496 used,   829904 buff/cache
KiB Swap:  1512244 total,  1247116 free,   265128 used.   419072 avail Mem 

after pressing 1:

top - 22:45:40 up 1 day,  1:14,  1 user,  load average: 0.16, 0.11, 0.18
Tasks: 225 total,   2 running, 223 sleeping,   0 stopped,   0 zombie
%Cpu0  :  1.6 us,  1.6 sy,  0.0 ni, 95.9 id,  0.8 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  0.8 us,  0.8 sy,  0.0 ni, 98.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3936368 total,   283964 free,  2813716 used,   838688 buff/cache
KiB Swap:  1512244 total,  1247176 free,   265068 used.   414712 avail Mem 

You can create/update your ~/.toprc file to make this the default by hitting W.

1

Graphical

  • Open System Monitor in your computer which fulfills your requirement

enter image description here

Command Line

  • Simply press 1 followed by top command to toggle to multiple cpu mode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.