Neither Python nor psutil has an API to get the current system load average as shown by tools like top. On Linux it's easy to retrieve the current load through /proc/loadavg, see http://www.linuxinsight.com/proc_loadavg.html
I've attached a patch with a simple implementation of get_load_average()
- simple_loadavg.patch 4.14KB
Comment #1
Posted on Dec 8, 2010 by Grumpy BearNo opinion on the patch, but python does have this as of 2.3. http://docs.python.org/library/os.html#os.getloadavg
$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import os os.getloadavg() (1.52, 1.6399999999999999, 1.5700000000000001)
Comment #2
Posted on Dec 8, 2010 by Happy RhinoOh, you are right ...
I'm currently in the process of replacing custom code with psutil. Some of my code is really, really old and predates Python 2.3. I rolled my own implementation of getloadavg() using /proc/loadavg many years ago and never checked if the os module has grown an official implementation.
Please dismiss my feature request.
Comment #3
Posted on Dec 8, 2010 by Happy MonkeyClosing out as won't fix. Thanks for the inputs btw. New ideas are always welcome.
Comment #4
Posted on Mar 1, 2013 by Happy MonkeyComment deleted
Comment #5
Posted on Mar 2, 2013 by Happy MonkeyUpdated csets after the SVN -> Mercurial migration: r266 == revision f910f2f333cc
Status: WontFix
Labels:
Type-Enhancement
Priority-Medium
OpSys-UNIX