You are not logged in.

#1 2020-09-25 10:25:21

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Understanding CPU usage

This may sound trivial, and perhaps I should know after many years of using Linux, but I'm stumped.

I have a conky, part of which includes the top four tasks in terms of CPU usage. The data from this is from an external script, which uses top. Conky typically reports more than 20% CPU usage.

nmon reports CPU usage total at around 4%.

Does top report a percentage of the total CPU, or a percentage of total CPU utilisation at the time (i.e. 20% CPU usage, or 20% of 4% = 0.8% of total)?

If the former, why are they so out of whack with each other?


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#2 2020-09-25 11:51:08

solskog
Member
Registered: 2020-09-05
Posts: 416

Re: Understanding CPU usage

I think top report 0.25% and that is 0.0025 out of 1.

Offline

#3 2020-09-25 12:33:45

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: Understanding CPU usage

a) depend on the top invocation and it's probably more about how several cores are handled (run top and press "1") - the number in the cpu column is per core, not per CPU
b) Heisenberg problem? Depending on how top is involved (and what other stuff conky runs at the time) it itself could be the cause for the high(er) load

Offline

#4 2020-09-25 13:35:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,529
Website

Re: Understanding CPU usage

seth wrote:

[top] itself could be the cause for the high(er) load

This.

I've often figured that "top" got it's name from the position of it's own listing it it's output when sorted by CPU use.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2020-09-25 14:04:09

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: Understanding CPU usage

To be sure: this script is so fancy that "${top name 1}${top name 2}${top name 3}${top name 4}" won't cut it?

@Trilby, try bashtop - überfancy, but makes top look anorexic ;-)

Offline

Board footer

Powered by FluxBB