Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is 25% CPU usage for glances normal? #1834

Closed
nahmias22 opened this issue Mar 31, 2021 · 14 comments
Closed

Is 25% CPU usage for glances normal? #1834

nahmias22 opened this issue Mar 31, 2021 · 14 comments
Assignees

Comments

@nahmias22
Copy link

To whom it may concern,

Is it normal to have 25% CPU usage for glances alone when running it as glances -w?

@GiganteX
Copy link

GiganteX commented Apr 1, 2021

25% ? That's nothing....

image

@nicolargo
Copy link
Owner

Hi @nahmias22

on my system, Glances take 7% of one CPU:

Selection_004

Try to disable some plugins on the server side to find the guilty:

glances -w --disable-plugin ports,sensors

Note: the plugins list can be display using:

glances --modules-list

Nicolas

@deefrawley
Copy link

I think you'll find it's the process list. Win10 running latest Glances on Python 39 and with the default refresh, process list shows CPU for the python process at around 35% (Win Task Manager shows python CPU usage at 7-10%). Hit 'z' to turn off process list and Glances drops to 5% CPU total for the python process (and Win Task Manager drops the python process down to about 0.3%)

@nicolargo
Copy link
Owner

@nahmias22 / @deefrawley : i just upload a new beta version (3.1.7b1) on Pypi test (pip install -i https://test.pypi.org/simple/ Glances).
This version has a new --issue option. Can you please install and run Glances with this new option. It will start and stop Glances and display stats like that:

image

Can you please copy/paste the result ?

@deefrawley
Copy link

deefrawley commented Apr 26, 2021

===========================================================
Glances version 3.1.7b1 with PsUtil 5.8.0
===========================================================
alert         [OK]    0.0000s []
amps          [OK]    0.0000s []
cloud         [OK]    0.0000s {}
connections   [OK]    0.0010s {'LISTEN': 36, 'ESTABLISHED': 24, 'SYN_SENT': 0, 'SYN_RECV':
core          [OK]    0.0000s {'phys': 6, 'log': 6}
cpu           [OK]    0.0000s {'total': 15.0, 'user': 6.5, 'system': 10.0, 'idle': 82.9, '
diskio        [OK]    0.0010s [{'time_since_update': 1, 'disk_name': 'PhysicalDrive0', 're
docker        [OK]    0.0000s []
folders       [OK]    0.0000s []
fs            [OK]    0.0010s [{'device_name': 'C:\\', 'fs_type': 'NTFS', 'mnt_point': 'C:
gpu           [OK]    0.0080s [{'key': 'gpu_id', 'gpu_id': 0, 'name': 'NVIDIA GeForce GTX
help          [OK]    0.0000s None
ip            [OK]    0.0000s {}
irq           [OK]    0.0000s []
load          [OK]    0.0000s {'min1': 0.0, 'min5': 0.0, 'min15': 0.0, 'cpucore': 6}
mem           [OK]    0.0000s {'total': 17121140736, 'available': 10251096064, 'percent':
memswap       [OK]    0.0000s {'total': 20208148480, 'used': 10335367168, 'free': 98727813
network       [OK]    0.0150s [{'interface_name': 
now           [OK]    0.0000s 2021-04-26 10:27:27 +1000
percpu        [OK]    0.0010s [{'key': 'cpu_number', 'cpu_number': 0, 'total': 17.1, 'user
ports         [OK]    0.0000s []
processcount  [OK]    0.9899s {'total': 224, 'running': 217, 'sleeping': 0, 'thread': 2717
processlist   [OK]    0.0000s [{'nice': <Priority.NORMAL_PRIORITY_CLASS: 32>, 'pid': 2536,
psutilversion [OK]    0.0000s (5, 8, 0)
quicklook     [OK]    1.6730s {'cpu': 25.3, 'percpu': [{'key': 'cpu_number', 'cpu_number':
raid          [OK]    0.0000s {}
sensors       [OK]    0.0000s []
smart         [N/A]
system        [OK]    0.0010s {'os_name': 'Windows', 'hostname': 
uptime        [OK]    0.0000s {'seconds': 4610}
wifi          [OK]    0.0000s []

@nicolargo
Copy link
Owner

Ok i understand, the issue came from #1820

Try to downgrade py-cpuinfo Python lib to 3.3.0 as written in the requirements file: https://github.com/nicolargo/glances/blob/develop/optional-requirements.txt#L22

To downgrade, use:

pip install --upgrade py-cpuinfo==3.3.0

@deefrawley
Copy link

py-cpuinfo is now v8. Why do we need to downgrade to v3?

@nicolargo
Copy link
Owner

@deefrawley because of this non corrected issue on py-cpuinfo ==> workhorsy/py-cpuinfo#155

@p5a0u9l
Copy link

p5a0u9l commented Jun 3, 2021

@nicolargo, I experienced this same regression. Does it make sense to pin py-cpuinfo in the setup.py?

@nicolargo
Copy link
Owner

nicolargo commented Jun 3, 2021 via email

@sunjam
Copy link

sunjam commented Jan 22, 2022

So how is CPU usage for everyone without that lib?

@nicolargo
Copy link
Owner

Between 5 and 9% of one CPU core on my system.

@sunjam
Copy link

sunjam commented May 27, 2022

@nahmias22 how is performance for you on the current release?

@nicolargo
Copy link
Owner

nicolargo commented May 28, 2022

With Glances 3.2.6.4 and PsUtil 5.9:

glances -w

takes less than 5% of one CPU (Intel(R) Core(TM) i7-4500U) on my computer (average on 30 seconds):

$ python
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
>>> import psutil
>>> psutil.Process(pid=62788)
psutil.Process(pid=62788, name='python', status='sleeping', started='10:56:42')
>>> p.cpu_percent(interval=30)
4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants