public GenerateAndOpenReport ( bool shouldOpen ) : void | ||
shouldOpen | bool | |
return | void |
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);
}
private static void RunTestForType(Type perfTestType, bool shouldOpen) { var isThroughputTest = typeof(IThroughputTest).IsAssignableFrom(perfTestType); var isLatencyTest = typeof(ILatencyTest).IsAssignableFrom(perfTestType); var typeName = perfTestType.Name; if (!isThroughputTest && !isLatencyTest) { Console.WriteLine($"*** ERROR *** Unable to determine the runner to use for this type ({typeName})"); return; } //Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal; if (isThroughputTest) { var session = new ThroughputTestSession(perfTestType); session.Run(); session.GenerateAndOpenReport(shouldOpen); } if (isLatencyTest) { var session = new LatencyTestSession(perfTestType); session.Run(); session.GenerateAndOpenReport(shouldOpen); } }