[crac] RFR: Correct System.nanotime() value after restore [v3]

Radim Vansa duke at openjdk.org
Fri Apr 14 07:23:05 UTC 2023


On Thu, 13 Apr 2023 15:25:17 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> If the monotonic time on the machine advanced by X, the offset can't be lower than -X (as the millis part is always positive) and therefore any difference between times read before and after will be at least 0. Therefore things snapshot might seem to take no time, but System.nanoTime() is still monotonic.
>
>> Therefore things snapshot might seem to take no time, but System.nanoTime() is still monotonic.
> 
> That's true and that is my concern. Before this change it was possible to measure how much time we've spent in checkpoint. My comment was that if we change the code as proposed, we'll deliberately provide inaccurate measurements based on realtime, not on the monotinic clock. Doing the adjustements is worse than doing nothing when restoring in the same environment.

Looks like there's `/proc/sys/kernel/random/boot_id` so we can set the offset only when the boot ID changes. Since monotonic time is ~time since boot, too, this could work well.

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

PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1166393299


More information about the crac-dev mailing list