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 eryksun
Recipients eryksun, jkloth, paul.moore, steve.dower, tim.golden, zach.ware
Date 2022-03-22.19:51:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647978688.65.0.802147114053.issue47096@roundup.psfhosted.org>
In-reply-to
Content
In bpo-44336, a new version of WindowsLoadTracker was implemented in Lib/test/libregrtest/win_utils.py. This version resolves issues with the previous implementation that spawned typeperf.exe. The new implementation uses the registry API's HKEY_PERFORMANCE_DATA pseudohandle to access the performance counters. This requires hard-coding "2" as the key name of the system object, 44 as the index of the "Processor Queue Length" counter, and also several struct definitions. 

The HKEY_PERFORMANCE_DATA 'key' just wraps the API as an alternate way to consume counter data. Instead of taking this detour through a minimalist interface just to use the API in a roundabout way, it would be better to implement a few of the Performance Data Helper functions in _winapi. I've implemented a prototype in ctypes to demonstrate this, which I'm attaching as "loadtracker.py". The functions that would need to be implemented are PdhOpenQueryW(), PdhAddEnglishCounterW(), PdhCollectQueryData(), PdhGetRawCounterValue(), and PdhCloseQuery().
History
Date User Action Args
2022-03-22 19:51:28eryksunsetrecipients: + eryksun, paul.moore, tim.golden, jkloth, zach.ware, steve.dower
2022-03-22 19:51:28eryksunsetmessageid: <1647978688.65.0.802147114053.issue47096@roundup.psfhosted.org>
2022-03-22 19:51:28eryksunlinkissue47096 messages
2022-03-22 19:51:28eryksuncreate