Re: High-resolution timer
Posted by
Michael Bien on
Nov 16, 2010; 5:01pm
URL: https://forum.jogamp.org/High-resolution-timer-tp1901680p1911947.html
On 11/16/2010 04:38 PM, gouessej [via jogamp] wrote:
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.
btw AMD provides an "optimizer" to workaround the multicore timing
issues:
http://support.amd.com/us/Pages/dynamicDetails.aspx?ListID=c5cd2c08-1432-4756-aafa-4d9dc646342f&ItemID=153
i am not aware of any timing issues regarding System.nanotime() on
other multicore CPUs.
regards,
michael
--
http://michael-bien.com/