From 38b4f89d9d1d3e101620b54e558e90b16e87d9b1 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 13 Dec 2011 04:45:39 +0100
Subject: setGLFunctionAvailability(..): Reduce the calls to
 resetProcAddressTable() 12 -> 7 in initialization.

Reducing the calls to resetProcAddressTable() 12 -> 7 in initialization, saves:
  Linux/AMD: 600ms -> 300ms
  Linux/NV:  161ms -> 112ms
  OSX 10.7/NV: 522ms -> 397ms

Still some freezes on OSX 10.6.8/NV .. further analysis is going on.
---
 .../junit/jogl/acore/TestShutdownCompleteNEWT.java | 37 +++++++++++++++++++++-
 .../junit/jogl/acore/TestShutdownSharedNEWT.java   | 18 +++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

(limited to 'src/test')

diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
index 40f13e834..1abac1094 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
@@ -28,7 +28,9 @@
  
 package com.jogamp.opengl.test.junit.jogl.acore;
 
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 
 import javax.media.opengl.GLCapabilities;
 import javax.media.opengl.GLProfile;
@@ -72,10 +74,15 @@ public class TestShutdownCompleteNEWT extends UITestCase {
     }
 
     protected void oneLife() throws InterruptedException {
+        if(waitForEach) {
+            waitForEnter();
+        }
         long t0 = System.nanoTime();
         GLProfile.initSingleton();
         long t1 = System.nanoTime();
-        runTestGL();        
+        if(!initOnly) {
+            runTestGL();
+        }
         long t2 = System.nanoTime();
         GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);        
         long t3 = System.nanoTime();
@@ -101,7 +108,35 @@ public class TestShutdownCompleteNEWT extends UITestCase {
         oneLife();
     }
     
+    static boolean initOnly = false;
+    static boolean waitForEach = false;
+    
+    static void waitForEnter() {
+        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+        System.err.println("Press enter to continue");
+        try {
+            System.err.println(stdin.readLine());
+        } catch (IOException e) { }        
+    }
+    
     public static void main(String args[]) throws IOException {
+        boolean waitForKey = false;
+        
+        for(int i=0; i<args.length; i++) {
+            if(args[i].equals("-wait")) {
+                waitForKey = true;
+            } else if(args[i].equals("-waitForEach")) {
+                waitForEach = true;
+                waitForKey = true;
+            } else if(args[i].equals("-initOnly")) {
+                initOnly = true;
+            }
+        }
+        
+        if(waitForKey) {
+            waitForEnter();
+        }
+        
         String tstname = TestShutdownCompleteNEWT.class.getName();
         org.junit.runner.JUnitCore.main(tstname);
     }
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
index b0096e2b1..99b5a6c48 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
@@ -28,7 +28,9 @@
  
 package com.jogamp.opengl.test.junit.jogl.acore;
 
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 
 import javax.media.opengl.GLCapabilities;
 import javax.media.opengl.GLProfile;
@@ -102,6 +104,22 @@ public class TestShutdownSharedNEWT extends UITestCase {
     }
     
     public static void main(String args[]) throws IOException {
+        boolean waitForKey = false;
+        
+        for(int i=0; i<args.length; i++) {
+            if(args[i].equals("-wait")) {
+                waitForKey = true;
+            }
+        }
+        
+        if(waitForKey) {
+            BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+            System.err.println("Press enter to continue");
+            try {
+                System.err.println(stdin.readLine());
+            } catch (IOException e) { }
+        }
+        
         String tstname = TestShutdownSharedNEWT.class.getName();
         org.junit.runner.JUnitCore.main(tstname);
     }
-- 
cgit v1.2.3