# HG changeset patch # User Doug Simon # Date 1359043133 -3600 # Node ID 68a59067974a13adaff99fbfb7d4f54c2dfe6da9 # Parent 2820060df9533f7a6fe9097c832b0dfceb47b8c3 made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others diff -r 2820060df953 -r 68a59067974a 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 Jan 24 16:44:40 2013 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java Thu Jan 24 16:58:53 2013 +0100 @@ -22,23 +22,8 @@ */ 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()); - } - }; +public abstract class DebugValue implements Comparable { private String name; private int index; @@ -76,5 +61,9 @@ return name; } + public int compareTo(DebugValue o) { + return name.compareTo(o.name); + } + public abstract String toString(long value); } diff -r 2820060df953 -r 68a59067974a 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 Jan 24 16:44:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jan 24 16:58:53 2013 +0100 @@ -285,7 +285,7 @@ List debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { ArrayList sortedValues = new ArrayList<>(debugValues); - Collections.sort(sortedValues, DebugValue.ORDER_BY_NAME); + Collections.sort(sortedValues); if (GraalOptions.SummarizeDebugValues) { printSummary(topLevelMaps, sortedValues);