From 0520400493a077348408be8f627ca70bf44be19c Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 16 Feb 2012 15:41:43 -0600 Subject: [PATCH] TestPerformance: print additional information about states/configs --- tool/test/org/antlr/v4/test/TestPerformance.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tool/test/org/antlr/v4/test/TestPerformance.java b/tool/test/org/antlr/v4/test/TestPerformance.java index b7cd703a9..c6c7afc86 100644 --- a/tool/test/org/antlr/v4/test/TestPerformance.java +++ b/tool/test/org/antlr/v4/test/TestPerformance.java @@ -44,7 +44,9 @@ import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.antlr.v4.runtime.atn.ATNConfig; @@ -298,6 +300,8 @@ public class TestPerformance extends BaseTest { if (SHOW_DFA_STATE_STATS) { int states = 0; + int configs = 0; + Set uniqueConfigs = new HashSet(); for (int i = 0; i < decisionToDFA.length; i++) { DFA dfa = decisionToDFA[i]; @@ -306,9 +310,13 @@ public class TestPerformance extends BaseTest { } states += dfa.states.size(); + for (DFAState state : dfa.states.values()) { + configs += state.configset.size(); + uniqueConfigs.addAll(state.configset); + } } - System.out.format("There are %d DFAState instances.\n", states); + System.out.format("There are %d DFAState instances, %d configs (%d unique).\n", states, configs, uniqueConfigs.size()); } int localDfaCount = 0;