V
- public class ProfilingParseRunner<V> extends AbstractParseRunner<V> implements MatchHandler
The ProfilingParseRunner is a special ParseRunner
implementation that "watches" a parser digest a number
of inputs and collects all sorts of statistical data on the what rules have matched how many times, the number
of reincovations of rules at identical input locations, and so on.
The ProfilingParseRunner is typically used during parser debugging and optimization, not in production.
Modifier and Type | Class and Description |
---|---|
static class |
ProfilingParseRunner.Report |
static class |
ProfilingParseRunner.RuleReport |
private static class |
ProfilingParseRunner.RuleStats |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Rule,ProfilingParseRunner.RuleReport> |
ruleReports |
private int |
runMatches |
private long |
timeCorrection |
private int |
totalMatches |
private int |
totalMismatches |
private long |
totalNanoTime |
private int |
totalRematches |
private int |
totalRemismatches |
private int |
totalRuns |
private DoWithMatcherVisitor.Action |
updateStatsAction |
Constructor and Description |
---|
ProfilingParseRunner(Rule rule)
Creates a new ProfilingParseRunner instance for the given rule.
|
Modifier and Type | Method and Description |
---|---|
ProfilingParseRunner.Report |
getReport() |
boolean |
match(MatcherContext<?> context)
Runs the given MatcherContext.
|
ParsingResult<V> |
run(InputBuffer inputBuffer)
Performs the actual parse and creates a corresponding ParsingResult instance.
|
createParsingResult, createRootContext, getParseErrors, getRootMatcher, getValueStack, resetValueStack, run, run, withParseErrors, withValueStack
private final java.util.Map<Rule,ProfilingParseRunner.RuleReport> ruleReports
private int runMatches
private int totalRuns
private int totalMatches
private int totalMismatches
private int totalRematches
private int totalRemismatches
private long totalNanoTime
private long timeCorrection
private final DoWithMatcherVisitor.Action updateStatsAction
public ProfilingParseRunner(Rule rule)
rule
- the parser rulepublic ParsingResult<V> run(InputBuffer inputBuffer)
ParseRunner
run
in interface ParseRunner<V>
inputBuffer
- the inputBuffer to usepublic ProfilingParseRunner.Report getReport()
public boolean match(MatcherContext<?> context)
MatchHandler
match
in interface MatchHandler
context
- the MatcherContext