Exemplo n.º 1
0
        private static void PrintResult(IBenchmarkResult result)
        {
            Table table = new Table("Name", "Total Ticks", "Average", "Min", "Max");

            table.AddRow(
                result.Name,
                TickHelper.ToHumanReadableTime(result.TotalTicks),
                TickHelper.ToHumanReadableTime(Convert.ToInt64(result.AverageTicks)),
                TickHelper.ToHumanReadableTime(result.MinimumTicks),
                TickHelper.ToHumanReadableTime(result.MaximumTicks));

            foreach (IBenchmarkResult metric in result.Results)
            {
                table.AddRow(
                    metric.Name,
                    TickHelper.ToHumanReadableTime(metric.TotalTicks),
                    TickHelper.ToHumanReadableTime(Convert.ToInt64(metric.AverageTicks)),
                    TickHelper.ToHumanReadableTime(metric.MinimumTicks),
                    TickHelper.ToHumanReadableTime(metric.MaximumTicks));
            }

            table.Config = TableConfiguration.UnicodeAlt();

            Console.WriteLine(table.ToString());

            table = new Table("Name", "Total Ticks", "Average", "Min", "Max");

            table.AddRow(
                result.Name,
                result.TotalTicks,
                result.AverageTicks,
                result.MinimumTicks,
                result.MaximumTicks);

            foreach (IBenchmarkResult metric in result.Results)
            {
                table.AddRow(
                    metric.Name,
                    metric.TotalTicks,
                    metric.AverageTicks,
                    metric.MinimumTicks,
                    metric.MaximumTicks);
            }

            table.Config = TableConfiguration.UnicodeAlt();

            Console.WriteLine(table.ToString());
            Console.Read();
        }