public BenchmarkResult Run() { WarmUp(); this.waitHandle.Set(); var start = BenchmarkRunner.TimeInNanoseconds(); WaitHandle.WaitAll(this.threadHandles); var end = BenchmarkRunner.TimeInNanoseconds(); var recordedTime = end - start; foreach (var thread in this.threads) { thread.Join(); } var result = new BenchmarkResult(this.name, this.name, this.threadCount, this.totalSeconds, recordedTime, this.threadCounts, this.threadTimes); PerformCollection(); return result; }
public BenchmarkResult Run() { WarmUp(); this.waitHandle.Set(); var start = BenchmarkRunner.TimeInNanoseconds(); WaitHandle.WaitAll(this.threadHandles); var end = BenchmarkRunner.TimeInNanoseconds(); var recordedTime = end - start; foreach (var thread in this.threads) { thread.Join(); } var result = new BenchmarkResult(this.name, this.name, this.threadCount, this.totalSeconds, recordedTime, this.threadCounts, this.threadTimes); PerformCollection(); return(result); }
private static void Display(BenchmarkResult result) { Console.WriteLine("{0} {1,2:N0} threads {2,15:N0} ops/sec | avg duration {3,8:N0} ns | {4,10:N0} avg ops/sec per thread", result.Name, result.Threads, result.OverallOperationsPerSecond, result.AverageOperationDuration, result.AverageOpsPerSecondPerThread); }