public class Profiler extends BlankDebugEventListener
Modifier and Type | Field and Description |
---|---|
protected int |
decisionLevel |
int[] |
decisionMaxCyclicLookaheads |
int[] |
decisionMaxFixedLookaheads |
List |
decisionMaxSynPredLookaheads |
protected CommonToken |
lastTokenConsumed |
protected List |
lookaheadStack |
protected int |
maxLookaheadInCurrentDecision |
int |
maxRuleInvocationDepth |
static int |
NUM_RUNTIME_STATS |
int |
numBacktrackDecisions |
protected int |
numberReportedErrors |
int |
numCharsMatched |
int |
numCyclicDecisions |
int |
numFixedDecisions |
int |
numGuessingRuleInvocations |
int |
numHiddenCharsMatched |
int |
numHiddenTokens |
int |
numMemoizationCacheEntries |
int |
numMemoizationCacheHits |
int |
numMemoizationCacheMisses |
int |
numRuleInvocations |
int |
numSemanticPredicates |
int |
numSyntacticPredicates |
DebugParser |
parser |
protected int |
ruleLevel |
static String |
RUNTIME_STATS_FILENAME |
static String |
Version
Because I may change the stats, I need to track that for later
computations to be consistent.
|
FALSE, PROTOCOL_VERSION, TRUE
Constructor and Description |
---|
Profiler() |
Profiler(DebugParser parser) |
Modifier and Type | Method and Description |
---|---|
void |
beginBacktrack(int level)
Track backtracking decisions.
|
void |
consumeHiddenToken(Token token)
An off-channel input token was consumed.
|
void |
consumeToken(Token token)
An input token was consumed; matched by any kind of element.
|
protected static String[] |
decodeReportData(String data) |
void |
endBacktrack(int level,
boolean successful)
Successful or not, track how much lookahead synpreds use
|
void |
enterDecision(int decisionNumber)
Every decision, fixed k or arbitrary, has an enter/exit event
so that a GUI can easily track what LT/consume events are
associated with prediction.
|
void |
enterRule(String grammarFileName,
String ruleName)
The parser has just entered a rule.
|
void |
examineRuleMemoization(IntStream input,
int ruleIndex,
String ruleName)
Track memoization; this is not part of standard debug interface
but is triggered by profiling.
|
void |
exitDecision(int decisionNumber) |
void |
exitRule(String grammarFileName,
String ruleName)
This is the last thing executed before leaving a rule.
|
int |
getNumberOfHiddenTokens(int i,
int j)
Get num hidden tokens between i..j inclusive
|
boolean |
inDecision()
The parser is in a decision if the decision depth > 0.
|
void |
LT(int i,
Token t)
Track refs to lookahead if in a fixed/nonfixed decision.
|
void |
memoize(IntStream input,
int ruleIndex,
int ruleStartIndex,
String ruleName) |
void |
recognitionException(RecognitionException e)
A recognition exception occurred such as NoViableAltException.
|
void |
semanticPredicate(boolean result,
String predicate)
A semantic predicate was evaluate with this result and action text
|
void |
setParser(DebugParser parser) |
void |
terminate()
Parsing is over; successfully or not.
|
protected int[] |
toArray(List a) |
String |
toNotifyString() |
String |
toString() |
static String |
toString(String notifyDataLine) |
protected int[] |
trim(int[] X,
int n) |
addChild, becomeRoot, beginResync, commence, consumeNode, createNode, createNode, endResync, enterAlt, enterSubRule, errorNode, exitSubRule, location, LT, mark, nilNode, rewind, rewind, setTokenBoundaries
public static final String Version
public static final String RUNTIME_STATS_FILENAME
public static final int NUM_RUNTIME_STATS
public DebugParser parser
protected int ruleLevel
protected int decisionLevel
protected int maxLookaheadInCurrentDecision
protected CommonToken lastTokenConsumed
protected List lookaheadStack
public int numRuleInvocations
public int numGuessingRuleInvocations
public int maxRuleInvocationDepth
public int numFixedDecisions
public int numCyclicDecisions
public int numBacktrackDecisions
public int[] decisionMaxFixedLookaheads
public int[] decisionMaxCyclicLookaheads
public List decisionMaxSynPredLookaheads
public int numHiddenTokens
public int numCharsMatched
public int numHiddenCharsMatched
public int numSemanticPredicates
public int numSyntacticPredicates
protected int numberReportedErrors
public int numMemoizationCacheMisses
public int numMemoizationCacheHits
public int numMemoizationCacheEntries
public Profiler()
public Profiler(DebugParser parser)
public void enterRule(String grammarFileName, String ruleName)
DebugEventListener
enterRule
in interface DebugEventListener
enterRule
in class BlankDebugEventListener
public void examineRuleMemoization(IntStream input, int ruleIndex, String ruleName)
public void exitRule(String grammarFileName, String ruleName)
DebugEventListener
exitRule
in interface DebugEventListener
exitRule
in class BlankDebugEventListener
public void enterDecision(int decisionNumber)
DebugEventListener
enterDecision
in interface DebugEventListener
enterDecision
in class BlankDebugEventListener
public void exitDecision(int decisionNumber)
exitDecision
in interface DebugEventListener
exitDecision
in class BlankDebugEventListener
public void consumeToken(Token token)
DebugEventListener
consumeToken
in interface DebugEventListener
consumeToken
in class BlankDebugEventListener
public boolean inDecision()
public void consumeHiddenToken(Token token)
DebugEventListener
consumeHiddenToken
in interface DebugEventListener
consumeHiddenToken
in class BlankDebugEventListener
public void LT(int i, Token t)
LT
in interface DebugEventListener
LT
in class BlankDebugEventListener
public void beginBacktrack(int level)
beginBacktrack
in interface DebugEventListener
beginBacktrack
in class BlankDebugEventListener
public void endBacktrack(int level, boolean successful)
endBacktrack
in interface DebugEventListener
endBacktrack
in class BlankDebugEventListener
public void recognitionException(RecognitionException e)
DebugEventListener
recognitionException
in interface DebugEventListener
recognitionException
in class BlankDebugEventListener
public void semanticPredicate(boolean result, String predicate)
DebugEventListener
semanticPredicate
in interface DebugEventListener
semanticPredicate
in class BlankDebugEventListener
public void terminate()
DebugEventListener
terminate
in interface DebugEventListener
terminate
in class BlankDebugEventListener
public void setParser(DebugParser parser)
public String toNotifyString()
protected int[] trim(int[] X, int n)
protected int[] toArray(List a)
public int getNumberOfHiddenTokens(int i, int j)
Copyright © 2020. All rights reserved.