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

Fix too low cpu_times_percent values when interval < ~1 second (#1586) #2413

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

frankkusters
Copy link

Summary

Description

Implement suggestion by @ulxasc in #1586 (comment) . This fixes that cpu_times_percent() reports much too low values if the interval is less than 1 second (with percpu=True) or less than 1/cpu_count() seconds (with percpu=False).

@giampaolo
Copy link
Owner

With this change I get one failure:

======================================================================
FAIL: psutil.tests.test_linux.TestMisc.test_cpu_steal_decrease
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/giampaolo/svn/psutil/psutil/tests/test_linux.py", line 1569, in test_cpu_steal_decrease
    self.assertNotEqual(sum(cpu_times_percent), 100.0)
AssertionError: 100.0 == 100.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

Successfully merging this pull request may close these issues.

[Ubuntu 16.04.6 LTS] cpu_times_percent wrong idle values when percpu=True
2 participants