Beispiel #1
0
        public override void Terminate()
        {
            string stats = ToNotifyString();

            try {
                Stats.WriteReport(RuntimeStatsFileName, stats);
            } catch (IOException ioe) {
                Console.Error.WriteLine(ioe);
                ExceptionExtensions.PrintStackTrace(ioe, Console.Error);
            }
            Console.Out.WriteLine(ToString(stats));
        }
Beispiel #2
0
        public override void Terminate()
        {
            string stats = ToNotifyString();

            try
            {
                Stats.WriteReport(RUNTIME_STATS_FILENAME, stats);
            }
            catch (IOException ex)
            {
                Console.Error.WriteLine(ex);
                Console.Error.WriteLine(ex.StackTrace);
            }
            Console.Out.WriteLine(Profiler.ToString(stats));
        }
Beispiel #3
0
        public override void Terminate()
        {
            string stats = ToNotifyString();

            try
            {
                Stats.WriteReport(RUNTIME_STATS_FILENAME, stats);
            }
            catch (IOException ioe)
            {
                Console.Error.WriteLine(ioe);
                ioe.PrintStackTrace(Console.Error);
            }
            Console.Out.WriteLine(ToString(stats));
        }
Beispiel #4
0
        // R E P O R T I N G


        public virtual string ToNotifyString()
        {
            ITokenStream input = parser.TokenStream;

            for (int i = 0; (i < input.Count) && (lastTokenConsumed != null) && (i <= lastTokenConsumed.TokenIndex); i++)
            {
                IToken t = input.Get(i);
                if (t.Channel != Token.DEFAULT_CHANNEL)
                {
                    numHiddenTokens++;
                    numHiddenCharsMatched += t.Text.Length;
                }
            }
            numCharsMatched             = lastTokenConsumed.StopIndex + 1;
            decisionMaxFixedLookaheads  = Trim(decisionMaxFixedLookaheads, numFixedDecisions);
            decisionMaxCyclicLookaheads = Trim(decisionMaxCyclicLookaheads, numCyclicDecisions);
            StringBuilder buf = new StringBuilder();

            buf.Append(Version);
            buf.Append('\t');
            buf.Append(parser.GetType().FullName);
            buf.Append('\t');
            buf.Append(numRuleInvocations);
            buf.Append('\t');
            buf.Append(maxRuleInvocationDepth);
            buf.Append('\t');
            buf.Append(numFixedDecisions);
            buf.Append('\t');
            buf.Append(Stats.Min(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Max(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Avg(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(numCyclicDecisions);
            buf.Append('\t');
            buf.Append(Stats.Min(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Max(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Avg(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(numBacktrackDecisions);
            buf.Append('\t');
            buf.Append(Stats.Min(ToArray(decisionMaxSynPredLookaheads)));
            buf.Append('\t');
            buf.Append(Stats.Max(ToArray(decisionMaxSynPredLookaheads)));
            buf.Append('\t');
            buf.Append(Stats.Avg(ToArray(decisionMaxSynPredLookaheads)));
            buf.Append('\t');
            buf.Append(Stats.Stddev(ToArray(decisionMaxSynPredLookaheads)));
            buf.Append('\t');
            buf.Append(numSemanticPredicates);
            buf.Append('\t');
            buf.Append(parser.TokenStream.Count);
            buf.Append('\t');
            buf.Append(numHiddenTokens);
            buf.Append('\t');
            buf.Append(numCharsMatched);
            buf.Append('\t');
            buf.Append(numHiddenCharsMatched);
            buf.Append('\t');
            buf.Append(numberReportedErrors);
            buf.Append('\t');
            buf.Append(numMemoizationCacheHits);
            buf.Append('\t');
            buf.Append(numMemoizationCacheMisses);
            buf.Append('\t');
            buf.Append(numGuessingRuleInvocations);
            buf.Append('\t');
            buf.Append(numMemoizationCacheEntries);
            return(buf.ToString());
        }
Beispiel #5
0
        public virtual string ToNotifyString()
        {
            ITokenStream input = _parser.TokenStream;

            for (int i = 0; i < input.Count && _lastTokenConsumed != null && i <= _lastTokenConsumed.TokenIndex; i++)
            {
                IToken t = input.Get(i);
                if (t.Channel != TokenChannels.Default)
                {
                    numHiddenTokens++;
                    numHiddenCharsMatched += t.Text.Length;
                }
            }
            numCharsMatched             = _lastTokenConsumed.StopIndex + 1;
            decisionMaxFixedLookaheads  = Trim(decisionMaxFixedLookaheads, numFixedDecisions);
            decisionMaxCyclicLookaheads = Trim(decisionMaxCyclicLookaheads, numCyclicDecisions);
            StringBuilder buf = new StringBuilder();

            buf.Append(Version);
            buf.Append('\t');
            buf.Append(_parser.GetType().Name);
            buf.Append('\t');
            buf.Append(numRuleInvocations);
            buf.Append('\t');
            buf.Append(maxRuleInvocationDepth);
            buf.Append('\t');
            buf.Append(numFixedDecisions);
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Min(EnumerableExtensions.DefaultIfEmpty(decisionMaxFixedLookaheads, int.MaxValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Max(EnumerableExtensions.DefaultIfEmpty(decisionMaxFixedLookaheads, int.MinValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Average(EnumerableExtensions.DefaultIfEmpty(decisionMaxFixedLookaheads, 0)));
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(numCyclicDecisions);
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Min(EnumerableExtensions.DefaultIfEmpty(decisionMaxCyclicLookaheads, int.MaxValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Max(EnumerableExtensions.DefaultIfEmpty(decisionMaxCyclicLookaheads, int.MinValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Average(EnumerableExtensions.DefaultIfEmpty(decisionMaxCyclicLookaheads, 0)));
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(numBacktrackDecisions);
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Min(EnumerableExtensions.DefaultIfEmpty(decisionMaxSynPredLookaheads, int.MaxValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Max(EnumerableExtensions.DefaultIfEmpty(decisionMaxSynPredLookaheads, int.MinValue)));
            buf.Append('\t');
            buf.Append(EnumerableExtensions.Average(EnumerableExtensions.DefaultIfEmpty(decisionMaxSynPredLookaheads, 0)));
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxSynPredLookaheads));
            buf.Append('\t');
            buf.Append(numSemanticPredicates);
            buf.Append('\t');
            buf.Append(_parser.TokenStream.Count);
            buf.Append('\t');
            buf.Append(numHiddenTokens);
            buf.Append('\t');
            buf.Append(numCharsMatched);
            buf.Append('\t');
            buf.Append(numHiddenCharsMatched);
            buf.Append('\t');
            buf.Append(numberReportedErrors);
            buf.Append('\t');
            buf.Append(numMemoizationCacheHits);
            buf.Append('\t');
            buf.Append(numMemoizationCacheMisses);
            buf.Append('\t');
            buf.Append(numGuessingRuleInvocations);
            buf.Append('\t');
            buf.Append(numMemoizationCacheEntries);
            return(buf.ToString());
        }