40

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
  • 23,850
  • 22
  • 76
  • 100
user678070
  • 1,415
  • 3
  • 18
  • 28

5 Answers5

44

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

Reto Aebersold
  • 16,306
  • 5
  • 55
  • 74
  • 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
41

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
  • 78,516
  • 15
  • 127
  • 132
18

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

Stefan Endrullis
  • 4,150
  • 2
  • 32
  • 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