Mercurial > hg > truffle
changeset 4553:7d0d849abf80
added option to summarize debug values
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Thu, 09 Feb 2012 18:35:47 -0800 |
parents | bc14f8e7d5ed |
children | daba89671d29 |
files | graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java |
diffstat | 3 files changed, 43 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Thu Feb 09 17:03:44 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Thu Feb 09 18:35:47 2012 -0800 @@ -97,6 +97,7 @@ // Debug settings: public static boolean Debug = true; + public static boolean SummarizeDebugValues = ____; public static String Dump = null; public static String Meter = null; public static String Time = null;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Thu Feb 09 17:03:44 2012 -0800 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Thu Feb 09 18:35:47 2012 -0800 @@ -194,17 +194,48 @@ List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps(); List<DebugValue> debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { - for (DebugValueMap map : topLevelMaps) { - TTY.println("Showing the results for thread: " + map.getName()); - map.group(); - map.normalize(); - printMap(map, debugValues, 0); + if (GraalOptions.SummarizeDebugValues) { + printSummary(topLevelMaps, debugValues); + } else { + for (DebugValueMap map : topLevelMaps) { + TTY.println("Showing the results for thread: " + map.getName()); + map.group(); + map.normalize(); + printMap(map, debugValues, 0); + } } } } } - private void printMap(DebugValueMap map, List<DebugValue> debugValues, int level) { + private static void printSummary(List<DebugValueMap> topLevelMaps, List<DebugValue> debugValues) { + DebugValueMap result = new DebugValueMap("Summary"); + for (int i = debugValues.size() - 1; i >= 0; i--) { + DebugValue debugValue = debugValues.get(i); + int index = debugValue.getIndex(); + long total = collectTotal(topLevelMaps, index); + result.setCurrentValue(index, total); + } + printMap(result, debugValues, 0); + } + + private static long collectTotal(List<DebugValueMap> maps, int index) { + long total = 0; + for (int i = 0; i < maps.size(); i++) { + DebugValueMap map = maps.get(i); + // the top level accumulates some counters -> do not process the children if we find a value + long value = map.getCurrentValue(index); + if (value == 0) { + total += collectTotal(map.getChildren(), index); + } else { + total += value; + } + } + return total; + } + + + private static void printMap(DebugValueMap map, List<DebugValue> debugValues, int level) { printIndent(level); TTY.println(map.getName());
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Thu Feb 09 17:03:44 2012 -0800 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Thu Feb 09 18:35:47 2012 -0800 @@ -23,6 +23,7 @@ package com.oracle.max.graal.hotspot.ri; import com.oracle.max.cri.ri.*; +import com.oracle.max.graal.debug.*; import com.oracle.max.graal.hotspot.*; import com.oracle.max.graal.hotspot.Compiler; @@ -108,7 +109,10 @@ currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition); } - exceptionPossiblyNotRecorded = !methodData.isWithin(currentPosition); + if (!methodData.isWithin(currentPosition)) { + exceptionPossiblyNotRecorded = true; + Debug.metric("InsufficientSpaceForProfilingData").increment(); + } } noDataFound(exceptionPossiblyNotRecorded);