On Tue, 1 Dec 2026 13:30:24 GMT, Markus Grönlund <[email protected]> wrote:

>> Erik Österlund has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Markus comments
>
> src/hotspot/os/windows/os_windows.cpp line 928:
> 
>> 926:   lock->unlock();
>> 927: 
>> 928:   if (!valid || (cache.CStatus != PDH_CSTATUS_VALID_DATA && 
>> cache.CStatus != PDH_CSTATUS_NEW_DATA) ||
> 
> This could probably be simplified:
> 
> 
> const bool valid_status = cache.CStatus == PDH_CSTATUS_VALID_DATA ||
>                           cache.CStatus == PDH_CSTATUS_NEW_DATA;
> const bool valid_type = type == PERF_COUNTER_LARGE_RAWCOUNT ||
>                         type == PERF_COUNTER_RAWCOUNT;
> 
> if (!valid || !valid_status || !valid_type ||
>     cache.FirstValue < 0 ||
>     static_cast<uint64_t>(cache.FirstValue) > total_physical) {
>   return 0;
> }

I agree - this looks simpler. Fixed!

> src/hotspot/os/windows/os_windows.cpp line 975:
> 
>> 973: 
>> 974: bool os::win32::available_memory(physical_memory_size_type& value) {
>> 975:   const physical_memory_size_type total = physical_memory();
> 
> Same inversion trick here, unless this is already fixed.

I didn't change physical_memory. But that's the machine memory size. That can't 
really change, can it? So I didn't see any opportunity for improving sampling 
accuracy on that one by moving it down.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/33895#discussion_r4755024921
PR Review Comment: https://git.openjdk.org/jdk/pull/33895#discussion_r4755059576

Reply via email to