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

Radim Vansa rvansa at openjdk.org
Tue Dec 23 09:18:03 UTC 2025


On Tue, 23 Dec 2025 06:57:08 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

>> 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.

Hmm, in fact `Score.setScore()` which is the 'main' to-be-API will be still silently ignored even if image score is not supported. On checkpoint, we check `isSupported()` anyway, and the default metrics are recorded already past the check, so changing this to return false won't cause any code bloat. Let's return false, then.

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

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


More information about the crac-dev mailing list