# HG changeset patch # User Doug Simon # Date 1387449524 -3600 # Node ID 2236d18302e0294c48167e04e67ce7a9737caf6f # Parent 424e2bfecb722a194e4cdbed48f684c3fd9ba6ea made -G:PrintCompRate incompatible with -XX:+CITime and -XX:+CITimeEach diff -r 424e2bfecb72 -r 2236d18302e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- 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(); diff -r 424e2bfecb72 -r 2236d18302e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java --- 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"); } diff -r 424e2bfecb72 -r 2236d18302e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- 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 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 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 PrintCompRate = new OptionValue<>(0); @Option(help = "Print bootstrap progress and summary") private static final OptionValue 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());