RFR: 8366780: Enhance ProcSmapsParser and Printer to handle THPeligible field [v2]
Stefan Johansson
sjohanss at openjdk.org
Fri Sep 5 07:02:47 UTC 2025
On Fri, 5 Sep 2025 06:23:04 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>> src/hotspot/os/linux/procMapsParser.hpp line 52:
>>
>>> 50: size_t anonhugepages;
>>> 51: size_t swap;
>>> 52: size_t thpeligible;
>>
>> Why `size`? Its name sounds like `bool`?
>
> Yes, it works like a `bool` but I represented it as a number to simply do the parsing similar to the other fields, but I guess I could handle it more like how `VmFlags` are handled.
>
> The the parsing would then look like this, would you prefer that:
>
> if (strncmp(_line, "THPeligible:", 12) == 0) {
> out.thpeligible = ::strstr(_line + 12, "1") != nullptr;
> return;
> }
>
>
> I think I would =)
Or actually make use of the unused ìnt` in the code, which I now when looking at the old review realize was used for the THPeligible field (but that parsing was then later removed).
I'll push a change which does:
// scan THPeligible into a bool
int thpel = 0;
if (::sscanf(_line, "THPeligible: %d", &thpel) == 1) {
out.thpeligible = (thpel == 1);
return;
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27098#discussion_r2324269607
More information about the serviceability-dev
mailing list