On Wed, 7 Mar 2001, Fred Klingener wrote:
> Thanks, Fabrizio. If others want to volunteer to run this for other OSs,
> email me the results at [EMAIL PROTECTED], and I'll summarize on my
> website. I've included a cleaned up version of the source.
Uhmm... in my assembler experience I learned that a procedure call can be
more time consuming than the the code of the procedure itself ;-)
I guess the following version is more precise:
/* Waittest
* March 7, 2001
* [EMAIL PROTECTED]
* Purpose: measures elapsed time between setting of wait(dt)
* and OS response.
* ...
* long start = System.currentTimeMillis();
* wt.waitStep(dt);
* int OSdt = (int) (System.currentTimeMillis()-start);
* ...
* public synchronized void waitStep(long t) {
* try{this.wait(t);}
* catch(InterruptedException e) {}
* ...
*/
import java.util.*;
import java.text.*;
public class mywaittest {
public DateFormat DayTime;
public static void main(String arg[]){
mywaittest wt = new mywaittest();
wt.doTest() ;
}
synchronized void doTest() {
this.DayTime = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
System.out.println("");
System.out.println("waittest.java version 03-07-01");
System.out.println("Run "+DayTime.format(new Date()));
System.out.println("os.name: "+System.getProperty("os.name"));
System.out.println("os.arch: "+System.getProperty("os.arch"));
System.out.println("os.version: "+System.getProperty("os.version"));
System.out.println("");
System.out.println("dt\tOSdt");
System.out.println("----\t----");
/* let's try it out of the cycle. */
try {
/* avoid stack re-allocation at every cycle. */
long start ;
int OSdt ;
for (int dt = 1; dt<50; dt++) {
start = System.currentTimeMillis();
this.wait(dt) ;
OSdt = (int) (System.currentTimeMillis()-start);
String s = new String();
for (int i = 0 ; i<OSdt ; i+=2)
s = s + "*";
System.out.println(dt+"\t"+OSdt+"\t"+s);
}
} catch(InterruptedException e) {}
}
}
> > I just tried it on a Sun Ultra 5, 128Mb ram, some ATI 8Mb video card,
> > jdk 1.2.2, j3d 1.1.3.
And these are the new results:
waittest.java version 03-07-01
Run 3/7/01 5:40 PM
os.name: SunOS
os.arch: sparc
os.version: 5.7
dt OSdt
---- ----
1 14 *******
2 20 **********
3 13 *******
4 14 *******
5 14 *******
6 17 *********
7 12 ******
8 14 *******
9 14 *******
10 15 ********
11 15 ********
12 15 ********
13 14 *******
14 15 ********
15 24 ************
16 24 ************
17 24 ************
18 25 *************
19 19 **********
20 29 ***************
21 29 ***************
22 29 ***************
23 29 ***************
24 29 ***************
25 29 ***************
26 29 ***************
27 29 ***************
28 29 ***************
29 29 ***************
30 39 ********************
31 39 ********************
32 39 ********************
33 39 ********************
34 39 ********************
35 39 ********************
36 39 ********************
37 39 ********************
38 39 ********************
39 40 ********************
40 49 *************************
41 49 *************************
42 49 *************************
43 49 *************************
44 49 *************************
45 49 *************************
46 49 *************************
47 49 *************************
48 49 *************************
49 49 *************************
what a nice shape. We wait 29, 39 or 49... nothing in between !?!?!
Uhmm....
regards,
Fabrizio Nunnari
--
http://digilander.iol.it/fnunnari
Fabrizio Nunnari <[EMAIL PROTECTED]>
-Student at Computer Science Department of Turin (Italy)-
Voodoo Chile of DeGeNeRaTiOn for the Amiga scene --> Coder
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".