Beispiel #1
0
        public EntryHistory Diff()
        {
            EntryHistory result = new EntryHistory();

            if (m_Entries.Count > 1)
            {
                for (int i = 1; i < m_Entries.Count; ++i)
                {
                    result.Add(m_Entries[i]);
                }
            }
            return(result);
        }
Beispiel #2
0
        static void OutputStats(Dictionary <string, ValueEntry> dict, string header, StatType type)
        {
            int           columnCount = 0;
            StringBuilder sb          = new StringBuilder();
            StringBuilder sbh         = new StringBuilder();

            foreach (var e in dict)
            {
                ValueEntry   ve   = e.Value;
                EntryHistory hist = ve.Diff();
                sb.Append(string.Format("{0}, {1}, {2}, {3}, {4}", e.Value.Name, hist.Min, hist.Max, hist.Sum, hist.Trend));
                switch (type)
                {
                case StatType.BASELINE:
                    columnCount = Math.Max(columnCount, hist.BaseLine.Count);
                    foreach (var d in hist.BaseLine)
                    {
                        sb.Append(string.Format(", {0}", d));
                    }
                    break;

                case StatType.DIFF:
                    columnCount = Math.Max(columnCount, hist.Diffs.Count);
                    foreach (var d in hist.Diffs)
                    {
                        sb.Append(string.Format(", {0}", d));
                    }
                    break;

                case StatType.VALUE:
                    columnCount = Math.Max(columnCount, hist.Entries.Count);
                    foreach (var d in hist.Entries)
                    {
                        sb.Append(string.Format(", {0}", d.Value));
                    }
                    break;
                }
                sb.AppendLine();
            }

            sbh.AppendLine("");
            sbh.AppendLine(string.Format("{0},{1}", header, type));
            sbh.Append(string.Format("Name, Min, Max, Sum, Trend, Base[0]"));
            switch (type)
            {
            case StatType.VALUE:
                for (int iCol = 1; iCol < columnCount; ++iCol)
                {
                    sbh.Append(string.Format(",Val[{0}]", iCol));
                }
                break;

            case StatType.DIFF:
                for (int iCol = 1; iCol < columnCount; ++iCol)
                {
                    sbh.Append(string.Format(",{0} -> {1}", iCol - 1, iCol));
                }
                break;

            case StatType.BASELINE:
                for (int iCol = 1; iCol < columnCount; ++iCol)
                {
                    sbh.Append(string.Format(",0 -> {1}", iCol));
                }
                break;
            }
            sbh.AppendLine("");

            Console.Write(sbh.ToString());
            Console.WriteLine(sb.ToString());
        }