TestPerformance: print additional information about states/configs

This commit is contained in:
Sam Harwell 2012-02-16 15:41:43 -06:00
parent feeaffc710
commit 0520400493
1 changed files with 9 additions and 1 deletions

View File

@ -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<ATNConfig> uniqueConfigs = new HashSet<ATNConfig>();
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;