changeset 12705:001b8429afc3

added ResetDebugValuesAfterBootstrap to separate out metrics gathered during bootstrap
author Doug Simon <doug.simon@oracle.com>
date Thu, 07 Nov 2013 18:33:01 +0100
parents 0e998f0daddf
children bb5fa27daa20
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java
diffstat 3 files changed, 43 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Thu Nov 07 11:17:23 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Thu Nov 07 18:33:01 2013 +0100
@@ -54,6 +54,8 @@
     public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
     @Option(help = "Omit reporting 0-value metrics")
     public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(false);
+    @Option(help = "Report and reset metrics after bootstrapping")
+    public static final OptionValue<Boolean> ResetDebugValuesAfterBootstrap = new OptionValue<>(true);
     @Option(help = "Send Graal IR to dump handlers on error")
     public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
     @Option(help = "Enable expensive assertions")
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java	Thu Nov 07 11:17:23 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java	Thu Nov 07 18:33:01 2013 +0100
@@ -55,6 +55,15 @@
         }
     }
 
+    public void reset() {
+        Arrays.fill(values, 0L);
+        if (children != null) {
+            for (DebugValueMap child : children) {
+                child.reset();
+            }
+        }
+    }
+
     private void ensureSize(int index) {
         if (values == null) {
             values = new long[index + 1];
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Nov 07 11:17:23 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Nov 07 18:33:01 2013 +0100
@@ -323,6 +323,9 @@
             }
         } while ((System.currentTimeMillis() - startTime) <= TimedBootstrap.getValue());
 
+        if (ResetDebugValuesAfterBootstrap.getValue()) {
+            printDebugValues("bootstrap", true);
+        }
         phaseTransition("bootstrap");
 
         bootstrapRunning = false;
@@ -368,6 +371,25 @@
             CompilationTask.withinEnqueue.set(Boolean.FALSE);
         }
 
+        printDebugValues(ResetDebugValuesAfterBootstrap.getValue() ? "application" : null, false);
+        phaseTransition("final");
+
+        if (runtime.getConfig().ciTime) {
+            parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond", System.out);
+            inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond", System.out);
+        }
+
+        SnippetCounter.printGroups(TTY.out().out());
+        BenchmarkCounters.shutdown(runtime.getCompilerToVM(), compilerStartTime);
+    }
+
+    private void printDebugValues(String phase, boolean reset) throws GraalInternalError {
+        TTY.println();
+        if (phase != null) {
+            TTY.println("<DebugValues:" + phase + ">");
+        } else {
+            TTY.println("<DebugValues>");
+        }
         if (Debug.isEnabled() && areMetricsOrTimersEnabled()) {
             List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
             List<DebugValue> debugValues = KeyRegistry.getDebugValues();
@@ -414,16 +436,17 @@
                         throw new GraalInternalError("Unknown summary type: %s", summary);
                 }
             }
+            if (reset) {
+                for (DebugValueMap topLevelMap : topLevelMaps) {
+                    topLevelMap.reset();
+                }
+            }
+            if (phase != null) {
+                TTY.println("</DebugValues:" + phase + ">");
+            } else {
+                TTY.println("</DebugValues>");
+            }
         }
-        phaseTransition("final");
-
-        if (runtime.getConfig().ciTime) {
-            parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond", System.out);
-            inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond", System.out);
-        }
-
-        SnippetCounter.printGroups(TTY.out().out());
-        BenchmarkCounters.shutdown(runtime.getCompilerToVM(), compilerStartTime);
     }
 
     private void flattenChildren(DebugValueMap map, DebugValueMap globalMap) {