Mercurial > hg > truffle
changeset 12714:655c87d8d3c2
added SnippetPreparationTime metric
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 08 Nov 2013 10:56:23 +0100 |
parents | 8716b7ceef94 |
children | b9f19a33dbb2 |
files | graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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; }