changeset 11515:65d2f38c0aa5

added timers for Truffle compilation pipeline
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Sep 2013 22:36:02 +0200
parents dc3c8df55905
children 9ea3658e7c5d
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Tue Sep 03 16:33:41 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Tue Sep 03 22:36:02 2013 +0200
@@ -36,6 +36,7 @@
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
@@ -107,6 +108,10 @@
         });
     }
 
+    public static final DebugTimer PartialEvaluationTime = Debug.timer("PartialEvaluationTime");
+    public static final DebugTimer CompilationTime = Debug.timer("CompilationTime");
+    public static final DebugTimer CodeInstallationTime = Debug.timer("CodeInstallation");
+
     private InstalledCode compileMethodImpl(final OptimizedCallTarget compilable) {
         final StructuredGraph graph;
         final GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault();
@@ -115,7 +120,9 @@
 
         compilable.timeCompilationStarted = System.nanoTime();
         Assumptions assumptions = new Assumptions(true);
-        graph = partialEvaluator.createGraph(compilable, assumptions);
+        try (TimerCloseable a = PartialEvaluationTime.start()) {
+            graph = partialEvaluator.createGraph(compilable, assumptions);
+        }
         compilable.timePartialEvaluationFinished = System.nanoTime();
         compilable.nodeCountPartialEval = graph.getNodeCount();
         InstalledCode compiledMethod = compileMethodHelper(graph, config, compilable, assumptions);
@@ -143,9 +150,11 @@
 
             @Override
             public CompilationResult call() {
-                CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
-                return GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, plan, OptimisticOptimizations.ALL, new SpeculationLog(),
-                                suites, new CompilationResult());
+                try (TimerCloseable a = CompilationTime.start()) {
+                    CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
+                    return GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, plan, OptimisticOptimizations.ALL, new SpeculationLog(),
+                                    suites, new CompilationResult());
+                }
             }
         });
 
@@ -169,11 +178,13 @@
 
             @Override
             public InstalledCode call() throws Exception {
-                InstalledCode installedCode = runtime.addMethod(graph.method(), result);
-                if (installedCode != null) {
-                    Debug.dump(new Object[]{result, installedCode}, "After code installation");
+                try (TimerCloseable a = CodeInstallationTime.start()) {
+                    InstalledCode installedCode = runtime.addMethod(graph.method(), result);
+                    if (installedCode != null) {
+                        Debug.dump(new Object[]{result, installedCode}, "After code installation");
+                    }
+                    return installedCode;
                 }
-                return installedCode;
             }
         });