# HG changeset patch # User Christian Haeubl # Date 1328901291 28800 # Node ID b27666ff9bd6db1cfe74a713739cf35d7a0056d7 # Parent ef00461e29af9768412be281f5c0b67d7862bab0 added compilation time statistics to product mode diff -r ef00461e29af -r b27666ff9bd6 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Fri Feb 10 10:16:19 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Fri Feb 10 11:14:51 2012 -0800 @@ -95,6 +95,9 @@ public static boolean PrintLIR = ____; public static boolean PrintCFGToFile = ____; + // statistics independent from debug mode + public static boolean PrintCompilationStatistics = ____; + // Debug settings: public static boolean Debug = true; public static boolean SummarizeDebugValues = ____; diff -r ef00461e29af -r b27666ff9bd6 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Fri Feb 10 10:16:19 2012 -0800 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Fri Feb 10 11:14:51 2012 -0800 @@ -50,6 +50,7 @@ private final Compiler compiler; private int compiledMethodCount; + private long totalCompilationTime; private IntrinsifyArrayCopyPhase intrinsifyArrayCopy; public final HotSpotTypePrimitive typeBoolean; @@ -217,6 +218,16 @@ } } } + + if (GraalOptions.PrintCompilationStatistics) { + printCompilationStatistics(); + } + } + + private void printCompilationStatistics() { + TTY.println("Accumulated compilation statistics"); + TTY.println(" Compiled methods : %d", compiledMethodCount); + TTY.println(" Total compilation time : %6.3f s", totalCompilationTime / Math.pow(10, 9)); } private static void printSummary(List topLevelMaps, List debugValues) { @@ -290,16 +301,16 @@ final PhasePlan plan = getDefaultPhasePlan(); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(compiler.getRuntime()); plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - long startTime = 0; + long startTime = System.nanoTime(); int index = compiledMethodCount++; final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed(); if (printCompilation) { TTY.println(String.format("Graal %4d %-70s %-45s %-50s ...", index, method.holder().name(), method.name(), method.signature().asString())); - startTime = System.nanoTime(); } CiTargetMethod result = null; TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method); + long nanoTime; try { result = Debug.scope("Compiling", method, new Callable() { @Override @@ -309,9 +320,10 @@ }); } finally { filter.remove(); + nanoTime = System.nanoTime() - startTime; + totalCompilationTime += nanoTime; if (printCompilation) { - long time = (System.nanoTime() - startTime) / 100000; - TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB", index, "", "", "", time / 10, time % 10, 0, (result != null ? result.targetCodeSize() + TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB", index, "", "", "", nanoTime / 1000000, nanoTime % 1000000, 0, (result != null ? result.targetCodeSize() : -1))); } }