1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
8 #include "atn/DecisionInfo.h"
13 class ProfilingATNSimulator;
15 /// This class provides access to specific and aggregate statistics gathered
16 /// during profiling of a parser.
17 class ANTLR4CPP_PUBLIC ParseInfo {
19 ParseInfo(ProfilingATNSimulator *atnSimulator);
20 ParseInfo(ParseInfo const&) = default;
23 ParseInfo& operator=(ParseInfo const&) = default;
26 /// Gets an array of <seealso cref="DecisionInfo"/> instances containing the profiling
27 /// information gathered for each decision in the ATN.
29 /// <returns> An array of <seealso cref="DecisionInfo"/> instances, indexed by decision
30 /// number. </returns>
31 virtual std::vector<DecisionInfo> getDecisionInfo();
34 /// Gets the decision numbers for decisions that required one or more
35 /// full-context predictions during parsing. These are decisions for which
36 /// <seealso cref="DecisionInfo#LL_Fallback"/> is non-zero.
38 /// <returns> A list of decision numbers which required one or more
39 /// full-context predictions during parsing. </returns>
40 virtual std::vector<size_t> getLLDecisions();
43 /// Gets the total time spent during prediction across all decisions made
44 /// during parsing. This value is the sum of
45 /// <seealso cref="DecisionInfo#timeInPrediction"/> for all decisions.
47 virtual long long getTotalTimeInPrediction();
50 /// Gets the total number of SLL lookahead operations across all decisions
51 /// made during parsing. This value is the sum of
52 /// <seealso cref="DecisionInfo#SLL_TotalLook"/> for all decisions.
54 virtual long long getTotalSLLLookaheadOps();
57 /// Gets the total number of LL lookahead operations across all decisions
58 /// made during parsing. This value is the sum of
59 /// <seealso cref="DecisionInfo#LL_TotalLook"/> for all decisions.
61 virtual long long getTotalLLLookaheadOps();
64 /// Gets the total number of ATN lookahead operations for SLL prediction
65 /// across all decisions made during parsing.
67 virtual long long getTotalSLLATNLookaheadOps();
70 /// Gets the total number of ATN lookahead operations for LL prediction
71 /// across all decisions made during parsing.
73 virtual long long getTotalLLATNLookaheadOps();
76 /// Gets the total number of ATN lookahead operations for SLL and LL
77 /// prediction across all decisions made during parsing.
80 /// This value is the sum of <seealso cref="#getTotalSLLATNLookaheadOps"/> and
81 /// <seealso cref="#getTotalLLATNLookaheadOps"/>.</para>
83 virtual long long getTotalATNLookaheadOps();
86 /// Gets the total number of DFA states stored in the DFA cache for all
87 /// decisions in the ATN.
89 virtual size_t getDFASize();
92 /// Gets the total number of DFA states stored in the DFA cache for a
93 /// particular decision.
95 virtual size_t getDFASize(size_t decision);
98 const ProfilingATNSimulator *_atnSimulator; // non-owning, we are created by this simulator.
102 } // namespace antlr4