changeset 13464:2236d18302e0

made -G:PrintCompRate incompatible with -XX:+CITime and -XX:+CITimeEach
author Doug Simon <doug.simon@oracle.com>
date Thu, 19 Dec 2013 11:38:44 +0100
parents 424e2bfecb72
children e2a14719e833
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java
diffstat 3 files changed, 23 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Dec 19 08:40:45 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Dec 19 11:38:44 2013 +0100
@@ -24,6 +24,7 @@
 
 import static com.oracle.graal.api.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
+import static com.oracle.graal.hotspot.bridge.VMToCompilerImpl.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
 import static com.oracle.graal.phases.GraalOptions.*;
 import static com.oracle.graal.phases.common.InliningUtil.*;
@@ -223,7 +224,7 @@
                 System.exit(-1);
             }
         } finally {
-            if ((config.ciTime || config.ciTimeEach) && installedCode != null) {
+            if ((config.ciTime || config.ciTimeEach || PrintCompRate.getValue() != 0) && installedCode != null) {
                 long processedBytes = InlinedBytecodes.getCurrentValue() - previousInlinedBytecodes;
                 long time = CompilationTime.getCurrentValue() - previousCompilationTime;
                 TimeUnit timeUnit = CompilationTime.getTimeUnit();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Thu Dec 19 08:40:45 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Thu Dec 19 11:38:44 2013 +0100
@@ -24,6 +24,7 @@
 package com.oracle.graal.hotspot;
 
 import static com.oracle.graal.compiler.GraalDebugConfig.*;
+import static com.oracle.graal.hotspot.bridge.VMToCompilerImpl.*;
 import static java.nio.file.Files.*;
 
 import java.io.*;
@@ -242,7 +243,7 @@
      * @param timeCompilations true if the CITime or CITimeEach HotSpot VM options are set
      */
     public static void finalizeOptions(boolean timeCompilations) {
-        if (timeCompilations) {
+        if (timeCompilations || PrintCompRate.getValue() != 0) {
             unconditionallyEnableTimerOrMetric(InliningUtil.class, "InlinedBytecodes");
             unconditionallyEnableTimerOrMetric(CompilationTask.class, "CompilationTime");
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Dec 19 08:40:45 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Dec 19 11:38:44 2013 +0100
@@ -64,8 +64,9 @@
     private static final OptionValue<Boolean> PrintQueue = new OptionValue<>(false);
 
     @Option(help = "Interval in milliseconds at which to print compilation rate periodically. " +
-                   "The compilation statistics are reset after each print out.")
-    private static final OptionValue<Integer> PrintCompRate = new OptionValue<>(0);
+                   "The compilation statistics are reset after each print out so this option " +
+                   "is incompatible with -XX:+CITime and -XX:+CITimeEach.")
+    public static final OptionValue<Integer> PrintCompRate = new OptionValue<>(0);
 
     @Option(help = "Print bootstrap progress and summary")
     private static final OptionValue<Boolean> PrintBootstrap = new OptionValue<>(true);
@@ -183,26 +184,25 @@
         }
 
         if (PrintCompRate.getValue() != 0) {
-            if (!runtime.getConfig().ciTime && !runtime.getConfig().ciTimeEach) {
-                TTY.println("PrintCompRate requires CITime or CITimeEach");
-            } else {
-                Thread t = new Thread() {
+            if (runtime.getConfig().ciTime || runtime.getConfig().ciTimeEach) {
+                throw new GraalInternalError("PrintCompRate is incompatible with CITime and CITimeEach");
+            }
+            Thread t = new Thread() {
 
-                    @Override
-                    public void run() {
-                        while (true) {
-                            runtime.getCompilerToVM().printCompilationStatistics(true, false);
-                            runtime.getCompilerToVM().resetCompilationStatistics();
-                            try {
-                                Thread.sleep(PrintCompRate.getValue());
-                            } catch (InterruptedException e) {
-                            }
+                @Override
+                public void run() {
+                    while (true) {
+                        runtime.getCompilerToVM().printCompilationStatistics(true, false);
+                        runtime.getCompilerToVM().resetCompilationStatistics();
+                        try {
+                            Thread.sleep(PrintCompRate.getValue());
+                        } catch (InterruptedException e) {
                         }
                     }
-                };
-                t.setDaemon(true);
-                t.start();
-            }
+                }
+            };
+            t.setDaemon(true);
+            t.start();
         }
 
         BenchmarkCounters.initialize(runtime.getCompilerToVM());