Re: High-resolution timer
Posted by
gouessej on
Nov 16, 2010; 3:38pm
URL: https://forum.jogamp.org/High-resolution-timer-tp1901680p1911462.html
Sven Gothel wrote
On Tuesday, November 16, 2010 12:36:49 gouessej [via jogamp] wrote:
>
> foxua wrote:
> >
> > Thanks for the reply
> > AFAIK nanotime() implementation has a bug - on some multicore systems it
> > behaves incorrectly.
> > I'll try to use nanotime() - maybe Oracle fixed it - I don't know.
> >
> I know this bug, I use a small workaround in TUER to detect when the time
> "seems" to come back :s It concerns only AMD microprocessors as far as I
> know.
We may add something in gluegen Platform class:
long getNanoTime(); // @return >=0 supported, <0 unsupported
just tell me where to fetch your implementation .. thank you.
Other ideas welcome, but I won't do it myself now, no time.
The native high-resolution timer used in LockSupport is not concerned by this bug. I have looked at my source code, I don't find the hack I used. Actually, I called very often System.nanoTime() and when 2 successive calls gave absurd result, I used the Olympic average to compute the elapsed time.