[issue36670] regrtest: win_utils decodes typeperf output from the wrong encoding (test suite broken due to cpu usage feature on win 10/ german)

STINNER Victor report at bugs.python.org
Mon Sep 30 04:56:15 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

We could avoid typeperf command by accessing directly performance counters:

(1) The Performance Data Helper (PDH) interface, which provides high-level access to data from both version 1 and version 2 performance counter providers.
(2) The registry interface, which provides low-level access to data from performance counter providers.
(3) The performance library interface, which provides direct access to data from version 2 performance counter providers.

https://docs.microsoft.com/en-us/windows/win32/perfctrs/consuming-counter-data

(2) in short: RegQueryValueEx() with HKEY_PERFORMANCE_DATA and the PPERF_DATA_BLOCK structure

Documentation:
https://docs.microsoft.com/en-us/windows/win32/perfctrs/using-the-registry-functions-to-consume-counter-data

PERF_DATA_BLOCK structure fields:
https://docs.microsoft.com/en-us/windows/win32/api/winperf/ns-winperf-perf_data_block

Example: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw

Some examples mention "RegQueryValueEx function. Use HKEY_PERFORMANCE_DATA".

Performance Data Format:
https://docs.microsoft.com/en-us/windows/win32/perfctrs/performance-data-format

--

PDH & friends was discussed in bpo-34060 which added the feature to libregrtest.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36670>
_______________________________________


More information about the Python-bugs-list mailing list