Class DecisionInfo
- java.lang.Object
-
- org.antlr.v4.runtime.atn.DecisionInfo
-
public class DecisionInfo extends Object
This class contains profiling gathered for a particular decision.Parsing performance in ANTLR 4 is heavily influenced by both static factors (e.g. the form of the rules in the grammar) and dynamic factors (e.g. the choice of input and the state of the DFA cache at the time profiling operations are started). For best results, gather and use aggregate statistics from a large sample of inputs representing the inputs expected in production before using the results to make changes in the grammar.
- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description List<AmbiguityInfo>
ambiguities
A collection ofAmbiguityInfo
instances describing the ambiguities encountered during LL prediction for this decision.List<ContextSensitivityInfo>
contextSensitivities
A collection ofContextSensitivityInfo
instances describing the context sensitivities encountered during LL prediction for this decision.int
decision
The decision number, which is an index intoATN.decisionToState
.List<ErrorInfo>
errors
A collection ofErrorInfo
instances describing the parse errors identified during calls toParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision.long
invocations
The total number of timesParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
was invoked for this decision.long
LL_ATNTransitions
The total number of ATN transitions required during LL prediction for this decision.long
LL_DFATransitions
The total number of DFA transitions required during LL prediction for this decision.long
LL_Fallback
Gets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.long
LL_MaxLook
Gets the maximum lookahead required for any single LL prediction to complete for this decision.LookaheadEventInfo
LL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theLL_MaxLook
value was set.long
LL_MinLook
Gets the minimum lookahead required for any single LL prediction to complete for this decision.long
LL_TotalLook
The sum of the lookahead required for LL prediction for this decision.List<PredicateEvalInfo>
predicateEvals
A collection ofPredicateEvalInfo
instances describing the results of evaluating individual predicates during prediction for this decision.long
SLL_ATNTransitions
The total number of ATN transitions required during SLL prediction for this decision.long
SLL_DFATransitions
The total number of DFA transitions required during SLL prediction for this decision.long
SLL_MaxLook
Gets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.LookaheadEventInfo
SLL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theSLL_MaxLook
value was set.long
SLL_MinLook
Gets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.long
SLL_TotalLook
The sum of the lookahead required for SLL prediction for this decision.long
timeInPrediction
The total time spent inParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision, in nanoseconds.
-
Constructor Summary
Constructors Constructor Description DecisionInfo(int decision)
Constructs a new instance of theDecisionInfo
class to contain statistics for a particular decision.
-
-
-
Field Detail
-
decision
public final int decision
The decision number, which is an index intoATN.decisionToState
.
-
invocations
public long invocations
The total number of timesParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
was invoked for this decision.
-
timeInPrediction
public long timeInPrediction
The total time spent inParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision, in nanoseconds.The value of this field contains the sum of differential results obtained by
System.nanoTime()
, and is not adjusted to compensate for JIT and/or garbage collection overhead. For best accuracy, use a modern JVM implementation that provides precise results fromSystem.nanoTime()
, and perform profiling in a separate process which is warmed up by parsing the input prior to profiling. If desired, callATNSimulator.clearDFA()
to reset the DFA cache to its initial state before starting the profiling measurement pass.
-
SLL_TotalLook
public long SLL_TotalLook
The sum of the lookahead required for SLL prediction for this decision. Note that SLL prediction is used before LL prediction for performance reasons even whenPredictionMode.LL
orPredictionMode.LL_EXACT_AMBIG_DETECTION
is used.
-
SLL_MinLook
public long SLL_MinLook
Gets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.
-
SLL_MaxLook
public long SLL_MaxLook
Gets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.
-
SLL_MaxLookEvent
public LookaheadEventInfo SLL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theSLL_MaxLook
value was set.
-
LL_TotalLook
public long LL_TotalLook
The sum of the lookahead required for LL prediction for this decision. Note that LL prediction is only used when SLL prediction reaches a conflict state.
-
LL_MinLook
public long LL_MinLook
Gets the minimum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (forPredictionMode.LL
, an ambiguity state (forPredictionMode.LL_EXACT_AMBIG_DETECTION
, or a syntax error.
-
LL_MaxLook
public long LL_MaxLook
Gets the maximum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (forPredictionMode.LL
, an ambiguity state (forPredictionMode.LL_EXACT_AMBIG_DETECTION
, or a syntax error.
-
LL_MaxLookEvent
public LookaheadEventInfo LL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theLL_MaxLook
value was set.
-
contextSensitivities
public final List<ContextSensitivityInfo> contextSensitivities
A collection ofContextSensitivityInfo
instances describing the context sensitivities encountered during LL prediction for this decision.- See Also:
ContextSensitivityInfo
-
errors
public final List<ErrorInfo> errors
A collection ofErrorInfo
instances describing the parse errors identified during calls toParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision.- See Also:
ErrorInfo
-
ambiguities
public final List<AmbiguityInfo> ambiguities
A collection ofAmbiguityInfo
instances describing the ambiguities encountered during LL prediction for this decision.- See Also:
AmbiguityInfo
-
predicateEvals
public final List<PredicateEvalInfo> predicateEvals
A collection ofPredicateEvalInfo
instances describing the results of evaluating individual predicates during prediction for this decision.- See Also:
PredicateEvalInfo
-
SLL_ATNTransitions
public long SLL_ATNTransitions
The total number of ATN transitions required during SLL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.If DFA caching of SLL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the SLL parsing algorithm will use ATN transitions exclusively.
-
SLL_DFATransitions
public long SLL_DFATransitions
The total number of DFA transitions required during SLL prediction for this decision.If the ATN simulator implementation does not use DFA caching for SLL transitions, this value will be 0.
-
LL_Fallback
public long LL_Fallback
Gets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.Note that this value is not related to whether or not
PredictionMode.SLL
may be used successfully with a particular grammar. If the ambiguity resolution algorithm applied to the SLL conflicts for this decision produce the same result as LL prediction for this decision,PredictionMode.SLL
would produce the same overall parsing result asPredictionMode.LL
.
-
LL_ATNTransitions
public long LL_ATNTransitions
The total number of ATN transitions required during LL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.If DFA caching of LL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the LL parsing algorithm will use ATN transitions exclusively.
-
LL_DFATransitions
public long LL_DFATransitions
The total number of DFA transitions required during LL prediction for this decision.If the ATN simulator implementation does not use DFA caching for LL transitions, this value will be 0.
-
-
Constructor Detail
-
DecisionInfo
public DecisionInfo(int decision)
Constructs a new instance of theDecisionInfo
class to contain statistics for a particular decision.- Parameters:
decision
- The decision number
-
-