This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients jkloth, louielu, terry.reedy, vstinner
Date 2017-06-19.12:24:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497875045.19.0.312637298333.issue30263@psf.upfronthosting.co.za>
In-reply-to
Content
> Pushed utility to github:  https://github.com/jkloth/loadavg

Hum, I see two implementations:

* LOADAVG_USE_REG: use the registry, RegQueryValueExW(HKEY_PERFORMANCE_DATA, L"2", ...)
* LOADAVG_USE_PDH: PdhOpenQueryW()

Are these API accessible by everyone? On Linux, the data is public to everybody:

haypo@selma$ ls -l /proc/loadavg 
-r--r--r--. 1 root root 0 Jun 19 14:18 /proc/loadavg

Why do you prefer registry over PDH?

Should CalculateLoad be called every 5 seconds in a thread? If yes, IMHO it's a blocker issue for regrtest since some tests fail if other threads are running.

I'm not sure that such code belongs to Python stdlib. What do you think of putting it on PyPI?

For Python 2, sometimes I would like to use faulthandler on our buildbots since it's really hard to guess what crashed Python when a random test crash. But faulthandler was only added to Python 3.3. So using it on Python 2 would require to install it using pip. Right now, Python only requires itself to run tests. I'm not sure that it's a good idea to have dependencies, even if there are externals.

Again, I'm not sure that this specific issue is the best place to discuss implementing "os.getloadavg()", since your implementation is more complex than a single function call, it seems like it requires to run a thread "in background", so maybe an object to start/stop the thread, etc.
History
Date User Action Args
2017-06-19 12:24:05vstinnersetrecipients: + vstinner, terry.reedy, jkloth, louielu
2017-06-19 12:24:05vstinnersetmessageid: <1497875045.19.0.312637298333.issue30263@psf.upfronthosting.co.za>
2017-06-19 12:24:05vstinnerlinkissue30263 messages
2017-06-19 12:24:04vstinnercreate