diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-04-12 00:47:03 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-04-12 00:47:03 +0200 |
commit | 55f4b24642b53c747540a02b4161753d1ea7e1f9 (patch) | |
tree | 2523f92d26e04d2b44f7c2eae7ba19f849d4eb60 | |
parent | 50defe14d1dabba3c048eaa5d8789239b0d7671f (diff) | |
download | psutil-55f4b24642b53c747540a02b4161753d1ea7e1f9.tar.gz |
update doc
-rw-r--r-- | docs/index.rst | 19 | ||||
-rw-r--r-- | psutil/__init__.py | 2 | ||||
-rwxr-xr-x | scripts/top.py | 3 |
3 files changed, 10 insertions, 14 deletions
diff --git a/docs/index.rst b/docs/index.rst index 1469e61b..95a5e2ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -240,17 +240,14 @@ CPU .. 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: + Return the average system load over the last 1, 5 and 15 minutes 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 that spawns a thread which updates the + average every 5 seconds, mimicking the UNIX behavior. Thus, the first time + this is called and for the next 5 seconds it will return a meaningless + ``(0.0, 0.0, 0.0)`` tuple. Example: .. code-block:: python diff --git a/psutil/__init__.py b/psutil/__init__.py index 07f1104b..4adb4509 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -210,7 +210,7 @@ __all__ = [ "pid_exists", "pids", "process_iter", "wait_procs", # proc "virtual_memory", "swap_memory", # memory "cpu_times", "cpu_percent", "cpu_times_percent", "cpu_count", # cpu - "cpu_stats", # "cpu_freq", + "cpu_stats", # "cpu_freq", "getloadavg" "net_io_counters", "net_connections", "net_if_addrs", # network "net_if_stats", "disk_io_counters", "disk_partitions", "disk_usage", # disk diff --git a/scripts/top.py b/scripts/top.py index 16f6da3b..69890e27 100755 --- a/scripts/top.py +++ b/scripts/top.py @@ -35,7 +35,6 @@ PID USER NI VIRT RES CPU% MEM% TIME+ NAME import atexit import datetime -import os import sys import time try: @@ -151,7 +150,7 @@ def print_header(procs_status, num_procs): # load average, uptime uptime = datetime.datetime.now() - \ datetime.datetime.fromtimestamp(psutil.boot_time()) - av1, av2, av3 = os.getloadavg() + av1, av2, av3 = psutil.getloadavg() line = " Load average: %.2f %.2f %.2f Uptime: %s" \ % (av1, av2, av3, str(uptime).split('.')[0]) print_line(line) |