public string BuildReport(ComputerSpecifications computerSpecifications)
{
var sb = new StringBuilder();
sb.AppendLine("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">")
.AppendLine("<html>")
.AppendLine(" <head>")
.AppendLine(" <title>Disruptor-net - Test Report</title>")
.AppendLine(" </head>")
.AppendLine(" <body>")
.AppendLine(" Local time: " + DateTime.Now + "<br>")
.AppendLine(" UTC time: " + DateTime.UtcNow);
sb.AppendLine(" <h2>Host configuration</h2>");
computerSpecifications.AppendHtml(sb);
if (computerSpecifications.NumberOfCores < 4)
{
sb.AppendFormat(" <b><font color='red'>Your computer has {0} physical core(s) but most of the tests require at least 4 cores</font></b><br>", computerSpecifications.NumberOfCores);
}
if (!Stopwatch.IsHighResolution)
{
sb.AppendFormat(" <b><font color='red'>Your computer does not support synchronized TSC, measured latencies might be wrong on multicore CPU architectures.</font></b><br>", computerSpecifications.NumberOfCores);
}
if (computerSpecifications.IsHyperThreaded)
{
sb.AppendLine(" <b><font color='red'>Hyperthreading can degrade performance, you should turn it off.</font></b><br>");
}
sb.AppendLine(" <h2>Test configuration</h2>")
.AppendLine(" Test: " + _perfTestType.FullName + "<br>")
.AppendLine(" Runs: " + Runs + "<br>");
if (_test.RequiredProcessorCount > Environment.ProcessorCount)
sb.AppendLine(" Warning ! Test requires: " + _test.RequiredProcessorCount + " processors but there is only " + Environment.ProcessorCount + " here <br>");
sb.AppendLine(" <h2>Detailed test results</h2>");
sb.AppendLine(" <table border=\"1\">");
sb.AppendLine(" <tr>");
sb.AppendLine(" <td>Run</td>");
sb.AppendLine(" <td>Latencies (hdr histogram output)</td>");
sb.AppendLine(" <td>Duration (ms)</td>");
sb.AppendLine(" <td># GC (0-1-2)</td>");
sb.AppendLine(" </tr>");
for (var i = 0; i < _results.Count; i++)
{
var result = _results[i];
result.AppendDetailedHtmlReport(i, sb);
}
sb.AppendLine(" </table>");
return sb.ToString();
}