public override IOSpeed GetTestResult(PartitionInfo partition, BenchmarkType type, BenchmarkFlags flags, CancellationToken cancellationToken) { var randomBenchmarkTimes = new TimeSpan[this.outstandingThreadsCount]; BenchmarkFile.OpenFileHandle(partition, type, handle => { Parallel.For(0, this.outstandingThreadsCount, i => { using (FileStream stream = new FileStream(handle, FileAccess.Read, BlockSize)) { Action<byte[], int, int> work = Utility.GetReadOrWriteAction(type, stream); randomBenchmarkTimes[i] = DoBenchmarkAlgorithm(stream, work, flags, cancellationToken); } }); }); var totalTimes = randomBenchmarkTimes.Aggregate((a, b) => a + b); return new IOSpeed(time: totalTimes, ioCount: BlockCount, bytes: BlockCount * BlockSize); }