OpenJDK / graal / graal-jvmci-8
changeset 12507:d72864a2886e
moved snippet timers/metrics from SnippetTemplate to SnippetInfo and added new metric for number of snippet specializations (i.e. number of SnippetTemplate objects created)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 21 Oct 2013 22:49:28 +0200 |
parents | 1be3cb11f88e |
children | 5cde653f58f9 |
files | graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java |
diffstat | 1 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Oct 21 22:47:54 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Oct 21 22:49:28 2013 +0200 @@ -71,6 +71,8 @@ protected final ResolvedJavaMethod method; protected final boolean[] constantParameters; protected final boolean[] varargsParameters; + private final DebugMetric instantiationCounter; + private final DebugTimer instantiationTimer; /** * The parameter names, taken from the local variables table. Only used for assertion @@ -80,7 +82,8 @@ protected SnippetInfo(ResolvedJavaMethod method) { this.method = method; - + instantiationCounter = Debug.metric("SnippetInstantiationCount[" + method.getName() + "]"); + instantiationTimer = Debug.timer("SnippetInstantiationTime[" + method.getName() + "]"); assert Modifier.isStatic(method.getModifiers()) : "snippet method must be static: " + MetaUtil.format("%H.%n", method); int count = method.getSignature().getParameterCount(false); constantParameters = new boolean[count]; @@ -316,6 +319,7 @@ } private static final DebugTimer SnippetCreationAndSpecialization = Debug.timer("SnippetCreationAndSpecialization"); + private static final DebugMetric SnippetSpecializations = Debug.metric("SnippetSpecializations"); /** * Base class for snippet classes. It provides a cache for {@link SnippetTemplate}s. @@ -355,6 +359,7 @@ protected SnippetTemplate template(final Arguments args) { SnippetTemplate template = templates.get(args.cacheKey); if (template == null) { + SnippetSpecializations.increment(); try (TimerCloseable a = SnippetCreationAndSpecialization.start()) { template = Debug.scope("SnippetSpecialization", args.info.method, new Callable<SnippetTemplate>() { @@ -385,9 +390,6 @@ return false; } - private final DebugMetric instantiationCounter; - private final DebugTimer instantiationTimer; - /** * Creates a snippet template. */ @@ -580,9 +582,6 @@ this.deoptNodes = curDeoptNodes; this.stampNodes = curStampNodes; this.returnNode = retNode; - - this.instantiationCounter = Debug.metric("SnippetInstantiationCount[" + method.getName() + "]"); - this.instantiationTimer = Debug.timer("SnippetInstantiationTime[" + method.getName() + "]"); } private static boolean checkAllVarargPlaceholdersAreDeleted(int parameterCount, ConstantNode[] placeholders) { @@ -865,8 +864,8 @@ */ public Map<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args) { assert checkSnippetKills(replacee); - try (TimerCloseable a = instantiationTimer.start()) { - instantiationCounter.increment(); + try (TimerCloseable a = args.info.instantiationTimer.start()) { + args.info.instantiationCounter.increment(); // Inline the snippet nodes, replacing parameters with the given args in the process StartNode entryPointNode = snippet.start(); FixedNode firstCFGNode = entryPointNode.next(); @@ -958,8 +957,8 @@ */ public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, LoweringTool tool, Arguments args) { assert checkSnippetKills(replacee); - try (TimerCloseable a = instantiationTimer.start()) { - instantiationCounter.increment(); + try (TimerCloseable a = args.info.instantiationTimer.start()) { + args.info.instantiationCounter.increment(); // Inline the snippet nodes, replacing parameters with the given args in the process String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}";