static void Main(string[] args) { ScenarioType scenarioType; ImplementationType implementationType; int runs; if (args == null || args.Length != 3 || !Enum.TryParse(args[0], out scenarioType) || !Enum.TryParse(args[1], out implementationType) || !int.TryParse(args[2], out runs) ) { PrintUsage(); return; } var specs = ComputerSpecifications.GetSpecificationsForPlatform(); Console.WriteLine(specs.ToString()); var session = new PerformanceTestSession(scenarioType, implementationType, runs); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal; session.Run(); session.GenerateAndOpenReport(); Console.ReadKey(); }
public void Report(Program.Options options) { var computerSpecifications = new ComputerSpecifications(); if (options.ShouldPrintComputerSpecifications) { Console.WriteLine(); Console.Write(computerSpecifications.ToString()); } if (!options.ShouldGenerateReport) { return; } var path = Path.Combine(Environment.CurrentDirectory, _perfTestType.Name + "-" + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".html"); File.WriteAllText(path, BuildReport(computerSpecifications)); var totalsPath = Path.Combine(Environment.CurrentDirectory, $"Totals-{DateTime.Now:yyyy-MM-dd}.csv"); File.AppendAllText(totalsPath, $"{DateTime.Now:HH:mm:ss},{_perfTestType.Name},{_results.Max(x => x.Histogram.GetValueAtPercentile(99))}\n"); if (options.ShouldOpenReport) { Process.Start(path); } }
public void Report(Program.Options options) { var computerSpecifications = new ComputerSpecifications(); if (options.ShouldPrintComputerSpecifications) { Console.WriteLine(); Console.Write(computerSpecifications.ToString()); } if (!options.ShouldGenerateReport) { return; } var path = Path.Combine(Environment.CurrentDirectory, _perfTestType.Name + "-" + DateTime.UtcNow.ToString("yyyy-MM-dd hh-mm-ss") + ".html"); File.WriteAllText(path, BuildReport(computerSpecifications)); var totalsPath = Path.Combine(Environment.CurrentDirectory, $"Totals-{DateTime.Now:yyyy-MM-dd}.csv"); var average = _results.Average(x => x.TotalOperationsInRun / x.Duration.TotalSeconds); File.AppendAllText(totalsPath, FormattableString.Invariant($"{DateTime.Now:HH:mm:ss},{_perfTestType.Name},{average}\n")); if (options.ShouldOpenReport) { Process.Start(path); } }
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()); }
private 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.PhysicalCoreCount < 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.PhysicalCoreCount); } 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: " + _runCount + "<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>Operations per second</td>"); sb.AppendLine(" <td>Duration (ms)</td>"); sb.AppendLine(" <td># GC (0-1-2)</td>"); sb.AppendLine(" <td>Batch %</td>"); sb.AppendLine(" <td>Average Batch Size<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()); }
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(); }
public void GenerateAndOpenReport(bool shouldOpen) { var path = Path.Combine(Environment.CurrentDirectory, _perfTestType.Name + "-" + DateTime.UtcNow.ToString("yyyy-MM-dd hh-mm-ss") + ".html"); var computerSpecifications = new ComputerSpecifications(); Console.WriteLine(computerSpecifications.ToString()); File.WriteAllText(path, BuildReport(computerSpecifications)); var totalsPath = Path.Combine(Environment.CurrentDirectory, $"Totals-{DateTime.Now:yyyy-MM-dd}.csv"); File.AppendAllText(totalsPath, $"{DateTime.Now:HH:mm:ss},{_perfTestType.Name},{_results.Average(x => x.TotalOperationsInRun / x.Duration.TotalSeconds)}\n"); if (shouldOpen) { Process.Start(path); } }
public void GenerateAndOpenReport(bool shouldOpen) { var path = Path.Combine(Environment.CurrentDirectory, _perfTestType.Name + "-" + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".html"); var computerSpecifications = new ComputerSpecifications(); Console.WriteLine(computerSpecifications.ToString()); File.WriteAllText(path, BuildReport(computerSpecifications)); var totalsPath = Path.Combine(Environment.CurrentDirectory, $"Totals-{DateTime.Now:yyyy-MM-dd}.csv"); File.AppendAllText(totalsPath, $"{DateTime.Now:HH:mm:ss},{_perfTestType.Name},{_results.Max(x => x.Histogram.GetValueAtPercentile(99))}\n"); if (shouldOpen) Process.Start(path); }