39

I have a program running on Linux and I need to determine how it is utilizing all the CPUs/cores. Is there any program for viewing this information?

Fábio Perez
  • 20,602
  • 20
  • 71
  • 96
user678070
  • 1,395
  • 3
  • 17
  • 27

5 Answers5

43

Run the 'top' command and press '1' to see the individual cores.

Reto Aebersold
  • 15,788
  • 4
  • 53
  • 71
  • 5
    great! But how can I save the command result into a file periodically by running a script? You know, you can't press a key in a script. Is there any 'top' option available to turn on this feature? – snowfox May 18 '12 at 08:47
  • @snowfox: you can press W (capitalized) when running `top` to save the current state. – Ynhockey Dec 30 '15 at 09:32
39

When runnging the top command, press f then j to display the P column (last CPU used by process), in addition to the 1 command in top, you should view some multi core occupation informations :)

Cédric Julien
  • 74,806
  • 15
  • 120
  • 127
18

htop shows you the cpu usage of each core in a graphical manner (ncurses).

Stefan Endrullis
  • 4,052
  • 2
  • 30
  • 45
4

mpstat -P ALL 5 5 >>your.file

You may need to parse this to use it for a presentation, or sum it But read the man page as mpstat has some useful options.

Ralph Byrd
  • 41
  • 1
4

Run the 'top' command and press '1' to see the individual core is the best way to see the cpu cores usage .. another option is run cmd- cat /proc/stat to see the cpu cores usage