Zing has the option to do just that on systems which reliably support it
(-XX:+UseRdtsc IIRC). So yes it can be done, and is sometimes even the
right thing to do.

On Tue, Apr 30, 2019 at 7:50 AM dor laor <dor.l...@gmail.com> 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
> <mechanical-sympathy@googlegroups.com> 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 mechanical-sympathy+unsubscr...@googlegroups.com.
>> 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 mechanical-sympathy+unsubscr...@googlegroups.com.
> 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 mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to