# HG changeset patch # User Doug Simon # Date 1383904583 -3600 # Node ID 655c87d8d3c29a3a18b14aaa6faef4d3888db391 # Parent 8716b7ceef94ad2440e43ec8c3830af085f18d5f added SnippetPreparationTime metric diff -r 8716b7ceef94 -r 655c87d8d3c2 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri Nov 08 10:55:48 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri Nov 08 10:56:23 2013 +0100 @@ -36,6 +36,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.debug.*; +import com.oracle.graal.debug.internal.*; import com.oracle.graal.graph.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; @@ -80,6 +81,7 @@ } private static final boolean UseSnippetGraphCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetGraphCache", "true")); + private static final DebugTimer SnippetPreparationTime = Debug.timer("SnippetPreparationTime"); public StructuredGraph getSnippet(ResolvedJavaMethod method) { assert method.getAnnotation(Snippet.class) != null : "Snippet must be annotated with @" + Snippet.class.getSimpleName(); @@ -87,13 +89,14 @@ StructuredGraph graph = UseSnippetGraphCache ? graphs.get(method) : null; if (graph == null) { - StructuredGraph newGraph = makeGraph(method, null, inliningPolicy(method), method.getAnnotation(Snippet.class).removeAllFrameStates()); - if (UseSnippetGraphCache) { - return newGraph; + try (TimerCloseable a = SnippetPreparationTime.start()) { + StructuredGraph newGraph = makeGraph(method, null, inliningPolicy(method), method.getAnnotation(Snippet.class).removeAllFrameStates()); + if (UseSnippetGraphCache) { + return newGraph; + } + graphs.putIfAbsent(method, newGraph); + graph = graphs.get(method); } - graphs.putIfAbsent(method, newGraph); - graph = graphs.get(method); - } return graph; }