# HG changeset patch # User Doug Simon # Date 1377722101 -7200 # Node ID 21738e530332273299c925e0b8cc88717f0f5ac6 # Parent 5d5bfb75dae03830fe45c3942a467884353dcd5e added metrics for timing front-end, back-end and code installation (GRAAL-448) diff -r 5d5bfb75dae0 -r 21738e530332 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Aug 28 22:34:22 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Aug 28 22:35:01 2013 +0200 @@ -34,6 +34,7 @@ import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; +import com.oracle.graal.debug.internal.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; @@ -52,6 +53,9 @@ */ public class GraalCompiler { + private static final DebugTimer FrontEnd = Debug.timer("FrontEnd"); + private static final DebugTimer BackEnd = Debug.timer("BackEnd"); + /** * Requests compilation of a given graph. * @@ -62,13 +66,9 @@ * argument can be null. * @return the result of the compilation */ - public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, - final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime, - final Replacements replacements, final Backend backend, - final TargetDescription target, final GraphCache cache, - final PhasePlan plan, final OptimisticOptimizations optimisticOpts, - final SpeculationLog speculationLog, final Suites suites, - final CompilationResult compilationResult) { + public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime, + final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts, + final SpeculationLog speculationLog, final Suites suites, final CompilationResult compilationResult) { Debug.scope("GraalCompiler", new Object[]{graph, runtime}, new Runnable() { public void run() { @@ -76,22 +76,26 @@ final LIR lir = Debug.scope("FrontEnd", new Callable() { public LIR call() { - return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); + try (TimerCloseable a = FrontEnd.start()) { + return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); + } } }); - final LIRGenerator lirGen = Debug.scope("BackEnd", lir, new Callable() { + try (TimerCloseable a = BackEnd.start()) { + final LIRGenerator lirGen = Debug.scope("BackEnd", lir, new Callable() { - public LIRGenerator call() { - return emitLIR(backend, target, lir, graph, cc); - } - }); - Debug.scope("CodeGen", lirGen, new Runnable() { + public LIRGenerator call() { + return emitLIR(backend, target, lir, graph, cc); + } + }); + Debug.scope("CodeGen", lirGen, new Runnable() { - public void run() { - emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner); - } + public void run() { + emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner); + } - }); + }); + } } }); diff -r 5d5bfb75dae0 -r 21738e530332 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Aug 28 22:34:22 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Aug 28 22:35:01 2013 +0200 @@ -113,6 +113,8 @@ */ public static final DebugTimer CompilationTime = Debug.timer("CompilationTime"); + public static final DebugTimer CodeInstallationTime = Debug.timer("CodeInstallation"); + public void runCompilation() { /* * no code must be outside this try/finally because it could happen otherwise that @@ -164,7 +166,9 @@ } } - installMethod(result); + try (TimerCloseable b = CodeInstallationTime.start()) { + installMethod(result); + } stats.finish(method); } catch (BailoutException bailout) { Debug.metric("Bailouts").increment();