[crac] RFR: 8373687: [CRaC] Add metrics through jcmd [v5]

Timofei Pushkin tpushkin at openjdk.org
Tue Dec 23 07:00:33 UTC 2025


On Mon, 22 Dec 2025 19:25:14 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> src/hotspot/share/runtime/crac.cpp line 726:
>> 
>>> 724:     // silently ignoring this
>>> 725:     return true;
>>> 726:   }
>> 
>> Not a part of this PR and we should've discussed this earlier, but why don't we fail here? We provide `is_image_score_supported` for Java to check, so we could make `Score.record()` not call this at all in such case. Same for the user-facing code: `Score.setScore` could throw `UnsupportedOperationException` when `Score.isSupported` returns `false`.
>
> I would think that most of the time the score calculation is quite cheap, and in that case the code would always look like
> 
> if (Score.isSupported()) {
>    Score.record(...);
> }
> 
> One line is better from code clarity, and one native call is better than two (assuming that it is supported when you're already in the CRaC resource that calls this).

I would prefer the explicit checks rather than silent ignoring, but I won't push.

Regarding performance, we could cache VM's return value inside `Score.isSupported()` — it is not supposed to change.

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

PR Review Comment: https://git.openjdk.org/crac/pull/281#discussion_r2642188701


More information about the crac-dev mailing list