Login  Register

Re: over 80% of time is in AWTAnimatorImpl.display() & GLDrawableHelper.displayImpl()

Posted by rtayek on Sep 12, 2012; 12:39am
URL: https://forum.jogamp.org/over-80-of-time-is-in-AWTAnimatorImpl-display-GLDrawableHelper-displayImpl-tp4026033p4026126.html

At 01:25 AM 9/11/2012, you wrote:
>Please use "our" hack to get some more precision under Windows,  ...

>Julien Gouesse http://tuer.sourceforge.nethttp://gouessej.wordpress.com

if you mean this hack (please see code below). it does not seem to
make much difference.  i get about a 1 ms. timer in either case;

thanks

import java.util.Arrays;
class Runner implements Runnable {
@Override public void run() {
while(true) {
try {
Thread.sleep(1);
} catch(InterruptedException e) {
e.printStackTrace();
}
long t1=System.nanoTime();
long dt=t1-t0;
t0=t1;
double millis=dt/1000000.;
dts[i++]=millis;
if(i>=10) {
System.out.println(Arrays.asList(dts));
i=0;
m++;
if(m>10)
break;
}
}
}
long t0;
int i,m,n=10;
Double[] dts=new Double[n];
}
public class ThreadTimer2 {
public static void main(String[] args) throws Exception {
if(useHack)
new Thread(new Runnable() {
@Override public void run() {
try {
Thread.sleep(Integer.MAX_VALUE);
} catch(InterruptedException e) {
e.printStackTrace();
}
}
}).start();
Runner r=new Runner();
r.t0=System.nanoTime();
new Thread(r).start();
}
static boolean useHack=false;
}



---
co-chair http://ocjug.org/