![]() ![]() ![]() ![]() Is there any particular problem with using WMI? Giampaolo, on your psutil issue you specifically said, "(possibly without using WMI)" Opened up a PR with a proof of concept to get feedback on if this approach is reasonable. I'm not sure if we still support Windows XP, but the alternative is to use PdhAddCounter, which breaks if the system language is not english because the counter paths are localized. One more caveat is that the PdhAddEnglishCounterW function is only available in Vista+. Like Jeremy noted, using WMI does add a 5mb overhead or so to the calling process. The load is stored as a global but the winapi module is already marked as "-1" indicating it has global state, so that shouldn't be a problem. Internally this uses a thread pool, but it means we don't have to worry about managing the thread ourselves. I've used Windows APIs in a way that we don't need to manually start up a thread and call a calc_load function, instead using a callback invoked by windows. After reading up on it, my take is that winapi is the most appropriate place for this, it is a non public api that's used in the stdlib. Thanks a lot for that link Jeremy, it was really helpful. There is an old ticket for this in psutil with some (possible useful) references in it: Taking a shot at this, should take a day or so.Īuthor: Giampaolo Rodola' (giampaolo.rodola) * There is a counter exposed called "System \ Processor Queue Length" which does what the equivalent of unix's loadīut we're gonna have to average it ourselves if we want this information. I would help to debug race conditions on Windows to log the "CPU usage" on regrtest, as we do on other platforms (using os.getloadavg()).Īnnoyingly, it looks like Windows does not provide an API that gives an average value. ![]() Ammar2, cheryl.sabella, giampaolo.rodola, jkloth, paul.moore, steve.dower, tim.golden, vstinner, zach.wareĬreated on 16:01 by vstinner, last changed 14:59 by admin. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |