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

High CPU consumption when using psutil.sensors_fans() #1199

Closed
nicolargo opened this issue Dec 30, 2017 · 4 comments
Closed

High CPU consumption when using psutil.sensors_fans() #1199

nicolargo opened this issue Dec 30, 2017 · 4 comments

Comments

@nicolargo
Copy link
Contributor

Hi @giampaolo ,

in Glances, if i enable the fans sensors plugin, i have an huge CPU consumption.

I reproduce the issue with this short code:

import time
import psutil
while True:
    print(psutil.sensors_fans())
    time.sleep(3)

The CPU consumption is the following (~ 14%):

selection_351

Can you reproduce on your system ?

PsUtil: 5.4.2
OS: Ubuntu 16.04
Hardware: Dell XPS 13

@giampaolo
Copy link
Owner

Can't reproduce it from here.

import time
import psutil

p = psutil.Process()
while True:
    print(psutil.sensors_fans())
    time.sleep(1)
    print(p.cpu_percent(interval=None))

Output:

{'asus': [sfan(label='cpu_fan', current=2900)]}
0.0
{'asus': [sfan(label='cpu_fan', current=2900)]}
1.0
{'asus': [sfan(label='cpu_fan', current=2900)]}
0.0
{'asus': [sfan(label='cpu_fan', current=2800)]}
1.0
{'asus': [sfan(label='cpu_fan', current=2800)]}
1.0
{'asus': [sfan(label='cpu_fan', current=2800)]}
0.0
{'asus': [sfan(label='cpu_fan', current=2800)]}
0.0
{'asus': [sfan(label='cpu_fan', current=2700)]}
1.0
{'asus': [sfan(label='cpu_fan', current=2700)]}
0.0
{'asus': [sfan(label='cpu_fan', current=2700)]}
0.0

@nicolargo
Copy link
Contributor Author

Same test on my system:

In [1]: import time
   ...: import psutil
   ...: 
   ...: p = psutil.Process()
   ...: while True:
   ...:     print(psutil.sensors_fans())
   ...:     time.sleep(1)
   ...:     print(p.cpu_percent(interval=None))
   ...:     
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
0.0
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.9
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.2
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.8
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.3
{'dell_smm': [sfan(label='Processor Fan', current=0)]}
33.9

@nicolargo
Copy link
Contributor Author

Just have a look and i can also reproduce the issue with a simple command line:

watch cat /sys/class/hwmon/hwmon2/fan1_input

So not a PsUtil issue but a Ubuntu/Dell Sensors one...

@wordlessly
Copy link

Same output on my system. CPU usage does not go up. Am I missing the fan speed sensor?

{}
0.0
{}
0.0
{}
0.0
{}
0.0

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

No branches or pull requests

3 participants