diff options
Diffstat (limited to 'psutil/__init__.py')
-rw-r--r-- | psutil/__init__.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index 5d2b8d3c..dc1a2c75 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -2017,6 +2017,20 @@ if hasattr(_psplatform, "cpu_freq"): __all__.append("cpu_freq") +_loadcounter_init = False + + +def getloadavg(): + global _loadcounter_init + if POSIX: + return os.getloadavg() + else: + if not _loadcounter_init: + _psplatform.cext.init_loadcounter() + _loadcounter_init = True + return _psplatform.cext.get_loadcounter() + + # ===================================================================== # --- system memory related functions # ===================================================================== |