# HG changeset patch # User Lukas Stadler # Date 1398352878 -7200 # Node ID a2f4ffc18d9de9568e8f73b0a6cc9306e4b55fba # Parent 0aed1c2d0caa4a5182e3befadce88d3451e0fe83 more fixes in BenchmarkCounters diff -r 0aed1c2d0caa -r a2f4ffc18d9d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Thu Apr 24 17:31:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Thu Apr 24 17:21:18 2014 +0200 @@ -289,25 +289,30 @@ final class BenchmarkCountersOutputStream extends CallbackOutputStream { private long startTime; + private boolean running; private boolean waitingForEnd; private BenchmarkCountersOutputStream(PrintStream delegate, String start, String end) { - super(delegate, new String[]{start, end, "\n"}); + super(delegate, new String[]{"\n", end, start}); } @Override protected void patternFound(int index) { switch (index) { - case 0: + case 2: startTime = System.nanoTime(); BenchmarkCounters.clear(compilerToVM.collectCounters()); + running = true; break; case 1: - waitingForEnd = true; + if (running) { + waitingForEnd = true; + } break; - case 2: + case 0: if (waitingForEnd) { waitingForEnd = false; + running = false; BenchmarkCounters.dump(delegate, (System.nanoTime() - startTime) / 1000000000d, compilerToVM.collectCounters(), 100); } break; @@ -371,7 +376,8 @@ public static void lower(DynamicCounterNode counter, HotSpotRegistersProvider registers, HotSpotVMConfig config, Kind wordKind) { StructuredGraph graph = counter.graph(); - if (excludedClassPrefix == null || (counter.graph().method() != null && !counter.graph().method().getDeclaringClass().getName().startsWith(excludedClassPrefix))) { + if (excludedClassPrefix == null || counter.graph().name != null || + (counter.graph().method() != null && !counter.graph().method().getDeclaringClass().getName().startsWith(excludedClassPrefix))) { ReadRegisterNode thread = graph.add(new ReadRegisterNode(registers.getThreadRegister(), wordKind, true, false)); diff -r 0aed1c2d0caa -r a2f4ffc18d9d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Thu Apr 24 17:31:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Thu Apr 24 17:21:18 2014 +0200 @@ -30,7 +30,7 @@ * This node can be used to add a counter to the code that will estimate the dynamic number of calls * by adding an increment to the compiled code. This should of course only be used for * debugging/testing purposes. - * + * * A unique counter will be created for each unique name passed to the constructor. Depending on the * value of withContext, the name of the root method is added to the counter's name. */ diff -r 0aed1c2d0caa -r a2f4ffc18d9d graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ProfileCompiledMethodsPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ProfileCompiledMethodsPhase.java Thu Apr 24 17:31:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ProfileCompiledMethodsPhase.java Thu Apr 24 17:21:18 2014 +0200 @@ -77,9 +77,7 @@ while (current.next() instanceof FixedWithNextNode) { current = (FixedWithNextNode) current.next(); } - if (graph.getEntryBCI() != -1) { - addSectionCounters(current, Arrays.asList(cfg.getBlocks()), cfg.getLoops(), schedule, probabilities); - } + addSectionCounters(current, Arrays.asList(cfg.getBlocks()), cfg.getLoops(), schedule, probabilities); } private static void addSectionCounters(FixedWithNextNode start, Collection sectionBlocks, Collection> childLoops, SchedulePhase schedule, NodesToDoubles probabilities) {