Ejemplo n.º 1
0
        private void PrintTable(SummaryTable table, ILogger logger)
        {
            if (table.FullContent.Length == 0)
            {
                logger.WriteLineError("<pre>There are no benchmarks found</pre>");
                return;
            }
            logger.Write("<pre><code>");
            table.PrintCommonColumns(logger);
            logger.WriteLine("</code></pre>");
            logger.NewLine();

            logger.WriteLine("<table>");
            var prefixLogger = new LoggerWithPrefix(logger, "\t");

            prefixLogger.Write("<tr>");
            table.PrintLine(table.FullHeader, prefixLogger, "<th>", "</th>");
            prefixLogger.WriteLine("</tr>");

            foreach (var line in table.FullContent)
            {
                prefixLogger.Write("<tr>");
                table.PrintLine(line, prefixLogger, "<td>", "</td>");
                prefixLogger.WriteLine("</tr>");
            }
            logger.WriteLine("</table>");

        }
Ejemplo n.º 2
0
        public override void ExportToLog(Summary summary, ILogger logger)
        {
            if (useCodeBlocks)
                logger.WriteLine($"```{codeBlocksSyntax}");
            logger = new LoggerWithPrefix(logger, prefix);
            logger.WriteLineInfo(EnvironmentHelper.GetCurrentInfo().ToFormattedString("Host"));
            logger.NewLine();

            PrintTable(summary.Table, logger);

            // TODO: move this logic to an analyser
            var benchmarksWithTroubles = summary.Reports.Values.Where(r => !r.GetResultRuns().Any()).Select(r => r.Benchmark).ToList();
            if (benchmarksWithTroubles.Count > 0)
            {
                logger.NewLine();
                logger.WriteLineError("Benchmarks with troubles:");
                foreach (var benchmarkWithTroubles in benchmarksWithTroubles)
                    logger.WriteLineError("  " + benchmarkWithTroubles.ShortInfo);
            }
        }