# HG changeset patch # User Lukas Stadler # Date 1336739998 -7200 # Node ID 19e5dc8d08914e4f58c346f73ce93dc191d9b5e2 # Parent 31ec401eb5922e00c4278bb5752e84b825866c67 alphabetically sort debug values for Metric and Time diff -r 31ec401eb592 -r 19e5dc8d0891 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java Thu May 10 14:24:25 2012 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java Fri May 11 14:39:58 2012 +0200 @@ -22,8 +22,24 @@ */ package com.oracle.graal.debug.internal; +import java.util.*; + public abstract class DebugValue { + public static final Comparator ORDER_BY_NAME = new Comparator() { + @Override + public int compare(DebugValue o1, DebugValue o2) { + // this keeps the "Runs" metric at the top of the list + if (o1.getName().equals("Runs")) { + return o2.getName().equals("Runs") ? 0 : -1; + } + if (o2.getName().equals("Runs")) { + return o1.getName().equals("Runs") ? 0 : 1; + } + return o1.getName().compareTo(o2.getName()); + } + }; + private String name; private int index; diff -r 31ec401eb592 -r 19e5dc8d0891 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 May 10 14:24:25 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri May 11 14:39:58 2012 +0200 @@ -260,14 +260,17 @@ List topLevelMaps = DebugValueMap.getTopLevelMaps(); List debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { + ArrayList sortedValues = new ArrayList<>(debugValues); + Collections.sort(sortedValues, DebugValue.ORDER_BY_NAME); + if (GraalOptions.SummarizeDebugValues) { - printSummary(topLevelMaps, debugValues); + printSummary(topLevelMaps, sortedValues); } else if (GraalOptions.PerThreadDebugValues) { for (DebugValueMap map : topLevelMaps) { TTY.println("Showing the results for thread: " + map.getName()); map.group(); map.normalize(); - printMap(map, debugValues, 0); + printMap(map, sortedValues, 0); } } else { DebugValueMap globalMap = new DebugValueMap("Global"); @@ -284,7 +287,7 @@ globalMap.group(); } globalMap.normalize(); - printMap(globalMap, debugValues, 0); + printMap(globalMap, sortedValues, 0); } } } @@ -331,6 +334,7 @@ printIndent(level); TTY.println("%s", map.getName()); + for (DebugValue value : debugValues) { long l = map.getCurrentValue(value.getIndex()); if (l != 0) {