RFR: JDK-8301661: Enhance os::pd_print_cpu_info on macOS and Windows
David Holmes
dholmes at openjdk.org
Sat Feb 4 05:05:51 UTC 2023
On Fri, 3 Feb 2023 08:25:09 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> Enhance os::pd_print_cpu_info on macOS and Windows by information about CPU frequency and caches.
> On Windows , this info can be obtained by the Processor Power Information API or "powerbase" (CallNtPowerInformation , see https://learn.microsoft.com/en-us/windows/win32/api/powerbase/nf-powerbase-callntpowerinformation ); this is available since Windows Server 2003/XP.
> On macOS, sysctlbyname can be used.
src/hotspot/os/windows/os_windows.cpp line 94:
> 92:
> 93: #include <malloc.h>
> 94: #include <powrprof.h>
The header should be `powerbase.h`
src/hotspot/os/windows/os_windows.cpp line 1888:
> 1886: ULONG MaxIdleState;
> 1887: ULONG CurrentIdleState;
> 1888: } PROCESSOR_POWER_INFORMATION, *PTR_PROCESSOR_POWER_INFORMATION;
We don't need the `*PTR_PROCESSOR_POWER_INFORMATION`
src/hotspot/os/windows/os_windows.cpp line 1891:
> 1889:
> 1890: // additional lib needed for PowerProf functionality
> 1891: #pragma comment(lib, "Powrprof.lib")
Not sure about this mechanism versus adding it to Makefile ??
src/hotspot/os/windows/os_windows.cpp line 1898:
> 1896:
> 1897: PROCESSOR_POWER_INFORMATION ppi;
> 1898: size_t sz_check = sizeof(ppi) * (size_t)si.dwNumberOfProcessors;
We already have `dwNumberOfProcessors` available in `processor_count()` - though we may have to zero-initialize it and check for zero in case we crash before we've done os::init
-------------
PR: https://git.openjdk.org/jdk/pull/12403
More information about the hotspot-runtime-dev
mailing list