Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Sep 5, 2017
1 parent a893f76 commit 0abd8c6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ CPU

Return the number of logical CPUs in the system (same as
`os.cpu_count() <http://docs.python.org/3/library/os.html#os.cpu_count>`__
in Python 3.4).
This number is not equivalent to the number of CPUs the current process can
use. The number of usable CPUs can be obtained with
in Python 3.4) or ``None`` if undetermined.
This number may not be equivalent to the number of CPUs the current process
can actually use in case process CPU affinity has been changed or Linux
cgroups are being used.
The number of usable CPUs can be obtained with
``len(psutil.Process().cpu_affinity())``.
If *logical* is ``False`` return the number of physical cores only (hyper
thread CPUs are excluded). Return ``None`` if undetermined.
thread CPUs are excluded).
On OpenBSD and NetBSD ``psutil.cpu_count(logical=False)`` always return
``None``. Example on a system having 2 physical hyper-thread CPU cores:

Expand All @@ -170,6 +172,11 @@ CPU
>>> psutil.cpu_count(logical=False)
2

Example returning the number of CPUs usable by the current process:

>>> len(psutil.Process().cpu_affinity())
1

.. function:: cpu_stats()

Return various CPU statistics as a named tuple:
Expand Down

0 comments on commit 0abd8c6

Please sign in to comment.