The implementation in the vdso changes with the running kernel and the hardware it runs on. You can't just copy it.

On 30/04/2019 21.46, 'Carl Mastrangelo' via mechanical-sympathy wrote:
If the kernel implementation of clock_gettime is correct, copying the implementation in the vDSO into the JVM should be okay too, right?  If rdtsc was not stable, it should have the same problems if invoked from either place?

On Monday, April 29, 2019 at 10:50:05 PM UTC-7, dor laor wrote:

    It might be since in the past many systems did not have a stable
    rdtsc and thus if the instruction is executed
    on different sockets it can result in wrong answers and negative
    time. Today most systems do have a stable tsc
    and you can verify it from userspace/java too.
    I bet it's easy to google the reason

    On Mon, Apr 29, 2019 at 2:36 PM 'Carl Mastrangelo' via
    mechanical-sympathy <[email protected] <javascript:>>
    wrote:

        This may be a dumb question, but why (on Linux) is
        System.nanotime() a call out to clock_gettime?    It seems
        like it could be inlined by the JVM, and stripped down to the
        rdtsc instruction.  From my reading of the vDSO source for
        x86, the implementation is not that complex, and could be
        copied into Java.
-- You received this message because you are subscribed to the
        Google Groups "mechanical-sympathy" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to
        [email protected] <javascript:>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to