LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-14-2018, 04:23 PM   #1
milomak
Member
 
Registered: May 2009
Posts: 147

Rep: Reputation: 18
top and CPU usage


i'm trying to understand how the individual app %CPU corresponds to the total CPU usage of the pc (which I assume is %Cpu(s) - us)

So looking at the below, the first few apps highlighted individually sum above 100%. Userspace Cpu usage seems at 22%


How should I be reading this?
 
Old 11-14-2018, 04:30 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Have you read the documentation? See man top
Granted, there's a lot there to absorb, but that's probably the best way to start. Come back with specific questions if you don't understand something.
Some food for thought: How many processors (CPUs) does your system have?
 
Old 11-14-2018, 05:31 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
"Lies, damned lies, and statistics".

Not only are the numbers different (overall versus per process) the latter are, as scasey hints, non-normalised.
And if everything is sleeping, how are they using CPU ?.
Back to my first sentence.

It doesn't pay to get too involved in the precise numbers, but use them as a general indication of what's happening - this is sampled data averaged over a time period after all.
 
Old 11-14-2018, 05:54 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
On my system, just starting a virtual machine:
Code:
top - 08:50:18 up  1:24,  1 user,  load average: 1.41, 0.43, 0.15
Tasks: 189 total,   1 running, 133 sleeping,   0 stopped,   0 zombie
%Cpu(s): 48.8 us,  1.2 sy,  0.0 ni, 49.3 id,  0.1 wa,  0.5 hi,  0.2 si,  0.0 st
KiB Mem : 16304420 total,  7985040 free,  6007852 used,  2311528 buff/cache
KiB Swap:  8191996 total,  8191996 free,        0 used.  9876744 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1965 qemu      20   0 9360252 5.219g  23676 S 199.0 33.6   2:14.72 qemu-syste+
It has an Intel i3 CPU, which looks like four CPUs to Linux. Notice the individual CPU usage of the qemu process. CPU summary is scaled and always adds up to 100% (or close).
 
Old 11-14-2018, 10:51 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@OP ; if you run top, then tap the '1' key whilst its running, it'll show you all the cpus individually - it may help
 
1 members found this post helpful.
Old 11-15-2018, 12:21 AM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
top may be useful in determining the cause of a problem, but I was taught to use the first line to see if there even is a problem:
Code:
top - 23:16:11 up 110 days, 23:38,  3 users,  load average: 0.01, 0.05, 0.05
Once can get that same information with the uptime command, which is probably what top uses
Code:
# uptime
 23:19:15 up 110 days, 23:41,  3 users,  load average: 0.32, 0.10, 0.07
Read up on what load average is telling you...man uptime has a paragraph
 
Old 11-15-2018, 04:10 PM   #7
milomak
Member
 
Registered: May 2009
Posts: 147

Original Poster
Rep: Reputation: 18
there was a point where the 2 top were 400% and 200%

you can imagine the system hung and i could not get those numbers
 
Old 11-16-2018, 08:15 AM   #8
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
+1 on chrism01's advise. Your machine does not have just 1 core; due to multiple cores and multithreads, top result can be over 100%.
top is not the only way to look at utilization. Look at sar data also.
 
Old 11-22-2018, 05:42 PM   #9
milomak
Member
 
Registered: May 2009
Posts: 147

Original Poster
Rep: Reputation: 18
what is sar data?
 
Old 11-22-2018, 05:52 PM   #10
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by milomak View Post
what is sar data?
Don't know if that was sarcastic question?

If not, good info here about sar:

https://en.wikipedia.org/wiki/Sar_(Unix)

https://www.thegeekstuff.com/2011/03/sar-examples/
 
Old 11-26-2018, 04:05 PM   #11
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by scasey View Post
Have you read the documentation? ... Come back with specific questions if you don't understand something.
I always appreciate it when people give helpful, friendly advice like this instead of just passing on by.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid 3 near 100% cpu usage and high RAM usage piman Linux - Software 1 11-16-2013 02:20 AM
[SOLVED] High CPU load, but low CPU usage (high idle CPU) baffy Linux - Newbie 5 03-13-2013 09:24 AM
CPU usage low in top, even though one process is using 80-90% of the CPU mwburden Linux - Software 6 10-23-2012 04:22 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration