RFR: 8364638: Refactor and make accumulated GC CPU time code generic [v5]

Stefan Johansson sjohanss at openjdk.org
Thu Aug 14 11:30:18 UTC 2025


On Thu, 14 Aug 2025 07:49:26 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> Jonas Norlinder has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Feedback from Albert
>
> src/hotspot/os/linux/os_linux.cpp line 4953:
> 
>> 4951:       // to detach itself from the VM - which should result in ESRCH.
>> 4952:       assert_status(rc == ESRCH, rc, "pthread_getcpuclockid failed");
>> 4953:       log_warning(os)("Could not sample thread CPU time (return code %d)", rc);
> 
> Do we really want add a warning here? This API is used from a lot a places and reading the comment above i sound like it might happen from time to time without it being a very big deal?
> 
> The risk I see is that we sometimes will get a bunch of these warning in test and they will fail because we can't handle the additional output.
> 
> The same goes for the other warnings below.

Looked closer at the users of this and one user is `ThreadMXBean.getThreadCpuTime(long id)`. Looking at the API docs for that, returning -1 is not a error but the expected result for a terminated thread. So I think we should remove these warnings.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26621#discussion_r2276356967


More information about the serviceability-dev mailing list