Пример #1
0
        public string Compare(BenchmarkResult other)
        {
            if (other == null)
            {
                return(string.Empty);
            }
            string compare = string.Format("Compare to {2}-test from {0} with {1} runs\r\n", other.TestDate, other.TestRuns, other.Tag);

            if (TestCode == other.TestCode)
            {
                compare += string.Format("Same syntax tree. Number of combinations: {0}\r\n", Combi);
            }
            else if (Combi == other.Combi)
            {
                compare += string.Format("Different tree! same number of combinations: {0}\r\n", Combi);
            }
            else
            {
                compare += string.Format("Different tree! Combinations: {0} vs {1}. Scale: {2}\r\n", Combi, other.Combi, other.Combi / Combi);
            }

            compare += "\r\n";
            int pad = 10;

            compare += string.Format("---Time-ms---|-{0}-|-{1}-|\r\n", Tag.PadLeft(pad, '-'), other.Tag.PadLeft(pad, '-'));
            compare += string.Format("---Parse ----|-{0}-|-{1}-|\r\n", TimeParse.ToString().PadLeft(pad), other.TimeParse.ToString().PadLeft(pad));
            compare += string.Format("---Query ----|-{0}-|-{1}-|\r\n", TimeQuery.ToString().PadLeft(pad), other.TimeQuery.ToString().PadLeft(pad));
            compare += "\r\n";
            compare += string.Format("---Memory-kb-|-{0}-|-{1}-|\r\n", Tag.PadLeft(pad, '-'), other.Tag.PadLeft(pad, '-'));
            compare += string.Format("---Parse ----|-{0}-|-{1}-|\r\n", MemParse.ToString().PadLeft(pad), other.MemParse.ToString().PadLeft(pad));

            return(compare);
        }
Пример #2
0
        public GeneralizeModel()
        {
            this.NameItem       = new List <string>();
            this.ColorItem      = new List <string>();
            this.TimeItem       = new List <string>();
            this.GeneralizeData = new List <GeneralizeData>();
            this.TimeParse      = new List <DateTime>();
            TimeItem.Add($"{DateTime.Now.AddDays(-27).ToString("MM月dd日")} - {DateTime.Now.AddDays(-21).ToString("MM月dd日")}");
            TimeItem.Add($"{DateTime.Now.AddDays(-20).ToString("MM月dd日")} - {DateTime.Now.AddDays(-14).ToString("MM月dd日")}");
            TimeItem.Add($"{DateTime.Now.AddDays(-13).ToString("MM月dd日")} - {DateTime.Now.AddDays(-7).ToString("MM月dd日")}");
            TimeItem.Add($"{DateTime.Now.AddDays(-6).ToString("MM月dd日")} - {DateTime.Now.ToString("MM月dd日")}");
            var date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            TimeParse.Add(date.AddDays(-27));
            TimeParse.Add(date.AddDays(-20));
            TimeParse.Add(date.AddDays(-13));
            TimeParse.Add(date.AddDays(-6));
        }