Пример #1
0
        /// <summary>
        /// Gets a count table of registered counters.
        /// </summary>
        /// <param name="Order">Optional sort order of records.</param>
        /// <returns>Count table</returns>
        public CountTable GetTotalCountTable(string[] Order = null)
        {
            CountTable Result = new CountTable();

            lock (this.buckets)
            {
                if (Order is null)
                {
                    foreach (IBucket Bucket in this.buckets.Values)
                    {
                        Result.Add(Bucket.Id, Bucket.TotalCount);
                    }
                }
                else
                {
                    foreach (string Id in Order)
                    {
                        if (this.buckets.TryGetValue(Id, out IBucket Bucket))
                        {
                            Result.Add(Bucket.Id, Bucket.TotalCount);
                        }
                    }
                }
            }

            return(Result);
        }
Пример #2
0
        private CountTable GetTable(out string[] Order)
        {
            Order = new string[]
            {
                EventType.Debug.ToString(),
                    EventType.Informational.ToString(),
                    EventType.Notice.ToString(),
                    EventType.Warning.ToString(),
                    EventType.Error.ToString(),
                    EventType.Critical.ToString(),
                    EventType.Alert.ToString(),
                    EventType.Emergency.ToString()
            };

            CountTable Table = this.buckets.GetTotalCountTable(Order);

            Table.SetBgColor(Order[0], "DarkBlue");
            Table.SetFgColor(Order[0], "White");

            Table.SetBgColor(Order[1], "LightGray");
            Table.SetFgColor(Order[1], "Black");

            Table.SetBgColor(Order[2], "LightYellow");
            Table.SetFgColor(Order[2], "Black");

            Table.SetBgColor(Order[3], "Yellow");
            Table.SetFgColor(Order[3], "Black");

            Table.SetBgColor(Order[4], "Red");
            Table.SetFgColor(Order[4], "Yellow");

            Table.SetBgColor(Order[5], "DarkRed");
            Table.SetFgColor(Order[5], "White");

            Table.SetBgColor(Order[6], "Purple");
            Table.SetFgColor(Order[6], "White");

            Table.SetBgColor(Order[7], "Black");
            Table.SetFgColor(Order[7], "White");

            return(Table);
        }
Пример #3
0
        /// <summary>
        /// Exports accumulated statistics to markdown
        /// </summary>
        /// <param name="Output">Markdown output</param>
        /// <param name="Model">Simulation model</param>
        public void ExportMarkdown(StreamWriter Output, Model Model)
        {
            CountTable Table = this.GetTable(out string[] Order);

            Output.WriteLine("Events");
            Output.WriteLine("=========");
            Output.WriteLine();

            Table.ExportTableGraph(Output, "Total event counts");

            SKColor[] Palette = new SKColor[]
            {
                SKColors.DarkBlue,
                SKColors.LightGray,
                SKColors.LightYellow,
                SKColors.Yellow,
                SKColors.Red,
                SKColors.DarkRed,
                SKColors.Purple,
                SKColors.Black
            };

            this.buckets.ExportCountHistoryGraph("Events", Order, Output, Model, null, Palette);
        }