summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAmmar Askar <ammar_askar@hotmail.com>2019-04-11 05:32:39 -0400
committerGiampaolo Rodola <g.rodola@gmail.com>2019-04-11 11:32:39 +0200
commit921870d54091f399cd2b129db19530cc486b5700 (patch)
tree099e24514ed9f1ea9317609e6e1deed8e0d44eb4 /docs
parent05d51649ca709c6626d84cc710c2470d64829848 (diff)
downloadpsutil-921870d54091f399cd2b129db19530cc486b5700.tar.gz
Implement getloadavg on Windows. Fixes #604 and #1484 (#1485) (patch by Ammar Askar)
Diffstat (limited to 'docs')
-rw-r--r--docs/DEVNOTES2
-rw-r--r--docs/index.rst30
2 files changed, 24 insertions, 8 deletions
diff --git a/docs/DEVNOTES b/docs/DEVNOTES
index c54fa938..abd2e368 100644
--- a/docs/DEVNOTES
+++ b/docs/DEVNOTES
@@ -69,8 +69,6 @@ FEATURES
- #613: thread names.
-- #604: emulate os.getloadavg() on Windows
-
- scripts/taskmgr-gui.py (using tk).
- system-wide number of open file descriptors:
diff --git a/docs/index.rst b/docs/index.rst
index 85429eb6..1469e61b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -238,6 +238,30 @@ CPU
.. versionchanged:: 5.5.1 added FreeBSD support.
+.. function:: getloadavg()
+
+ Returns the average load on the system over the last 1, 5 and 15 minutes
+ respectively as a tuple. The load represents how many processes are waiting
+ to be run by the operating system.
+
+ On UNIX systems this relies on `os.getloadavg`_. On Windows, this is
+ emulated by using a Windows API call that spawns a thread which updates the
+ average every 5 seconds mimicking the UNIX behavior. Thus, the first time
+ this is called and up until 5 seconds it returns a meaningless
+ ``(0.0, 0.0, 0.0)`` tuple.
+
+ Example:
+
+ .. code-block:: python
+
+ >>> import psutil
+ >>> psutil.getloadavg()
+ (3.14, 3.89, 4.67)
+
+ Availability: Unix, Windows
+
+ .. versionadded:: 5.6.2
+
Memory
------
@@ -2556,12 +2580,6 @@ FAQs
the Python script as a Windows service (this is the trick used by tools
such as ProcessHacker).
-----
-
-* Q: What about load average?
-* A: psutil does not expose any load average function as it's already available
- in python as `os.getloadavg`_.
-
Running tests
=============