changeset 13199:bae0869c829a

put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property
author Doug Simon <doug.simon@oracle.com>
date Sat, 30 Nov 2013 01:48:18 +0100
parents 9a971210a55a
children ebdc13d9845d
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java
diffstat 1 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Sat Nov 30 01:33:29 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Sat Nov 30 01:48:18 2013 +0100
@@ -127,6 +127,22 @@
         }
     }
 
+    public static void println() {
+        println("");
+    }
+
+    public static void println(String format, Object... args) {
+        println(String.format(format, args));
+    }
+
+    public static final boolean LOG = Boolean.getBoolean("graal.compileTheWorldTest.log");
+
+    public static void println(String s) {
+        if (LOG) {
+            TTY.println(s);
+        }
+    }
+
     /**
      * Compile all methods in all classes in the Zip/Jar files passed.
      * 
@@ -141,13 +157,13 @@
 
             // For now we only compile all methods in all classes in zip/jar files.
             if (!entry.endsWith(".zip") && !entry.endsWith(".jar")) {
-                TTY.println("CompileTheWorld : Skipped classes in " + entry);
-                TTY.println();
+                println("CompileTheWorld : Skipped classes in " + entry);
+                println();
                 continue;
             }
 
-            TTY.println("CompileTheWorld : Compiling all classes in " + entry);
-            TTY.println();
+            println("CompileTheWorld : Compiling all classes in " + entry);
+            println();
 
             URL url = new URL("jar", "", "file:" + entry + "!/");
             ClassLoader loader = new URLClassLoader(new URL[]{url});
@@ -182,13 +198,13 @@
                         }
                     } catch (Throwable t) {
                         // If something went wrong during pre-loading we just ignore it.
-                        TTY.println("Preloading failed for (%d) %s", classFileCounter, className);
+                        println("Preloading failed for (%d) %s", classFileCounter, className);
                     }
 
                     // Are we compiling this class?
                     HotSpotMetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess();
                     if (classFileCounter >= startAt) {
-                        TTY.println("CompileTheWorld (%d) : %s", classFileCounter, className);
+                        println("CompileTheWorld (%d) : %s", classFileCounter, className);
 
                         // Enqueue each constructor/method in the class for compilation.
                         for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
@@ -205,14 +221,14 @@
                         }
                     }
                 } catch (Throwable t) {
-                    TTY.println("CompileTheWorld (%d) : Skipping %s", classFileCounter, className);
+                    println("CompileTheWorld (%d) : Skipping %s", classFileCounter, className);
                 }
             }
             jarFile.close();
         }
 
-        TTY.println();
-        TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime);
+        println();
+        println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime);
     }
 
     /**
@@ -227,7 +243,7 @@
             method.reprofile();  // makes the method also not-entrant
         } catch (Throwable t) {
             // Catch everything and print a message
-            TTY.println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, MetaUtil.format("%H.%n(%p):%r", method));
+            println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, MetaUtil.format("%H.%n(%p):%r", method));
             t.printStackTrace(TTY.cachedOut);
         }
     }