Пример #1
0
        /// <summary>Track memoization</summary>
        /// <remarks>
        /// This is not part of standard debug interface but is triggered by
        /// profiling.  Code gen inserts an override for this method in the
        /// recognizer, which triggers this method.
        /// </remarks>
        public void ExamineRuleMemoization(IIntStream input, int ruleIndex, string ruleName)
        {
            int stopIndex = parser.GetRuleMemoization(ruleIndex, input.Index());

            if (stopIndex == BaseRecognizer.MEMO_RULE_UNKNOWN)
            {
                numMemoizationCacheMisses++;
                numGuessingRuleInvocations++;                 // we'll have to enter
            }
            else
            {
                // regardless of rule success/failure, if in cache, we have a cache hit
                numMemoizationCacheHits++;
            }
        }
Пример #2
0
 /// <summary>Track memoization</summary>
 /// <remarks>
 /// This is not part of standard debug interface but is triggered by 
 /// profiling.  Code gen inserts an override for this method in the 
 /// recognizer, which triggers this method.
 /// </remarks>
 public void ExamineRuleMemoization(IIntStream input, int ruleIndex, string ruleName)
 {
     int stopIndex = parser.GetRuleMemoization(ruleIndex, input.Index());
     if (stopIndex == BaseRecognizer.MEMO_RULE_UNKNOWN)
     {
         numMemoizationCacheMisses++;
         numGuessingRuleInvocations++; // we'll have to enter
     }
     else
     {
         // regardless of rule success/failure, if in cache, we have a cache hit
         numMemoizationCacheHits++;
     }
 }