protected override TimeSpan DoBenchmarkAlgorithm(FileStream stream, Action<byte[], int, int> work, BenchmarkFlags flags, CancellationToken cancellationToken)
 {
     var sequenceReadTimeTotal = new TimeSpan(0);
     byte[] buffer = AssemblyUtility.GetData(BlockSize, flags.HasFlag(BenchmarkFlags.Compressible));
     for (int i = 0; i < BlockCount; i++)
     {
         cancellationToken.ThrowIfCancellationRequested();   //可以取消
         sequenceReadTimeTotal += AssemblyUtility.GetTime(() => work(buffer, 0, buffer.Length));
     }
     return sequenceReadTimeTotal;
 }
        protected override TimeSpan DoBenchmarkAlgorithm(FileStream stream, Action<byte[], int, int> work, BenchmarkFlags flags, CancellationToken cancellationToken)
        {
            var random = new Random();
            TimeSpan timeTotal = default(TimeSpan);
            for (int j = 0; j < BlockCount / this.outstandingThreadsCount; j++)
            {
                cancellationToken.ThrowIfCancellationRequested();   //可以取消

                var randomArray = AssemblyUtility.GetData(BlockSize, flags.HasFlag(BenchmarkFlags.Compressible));
                long posision = BlockSize * random.Next(BlockCount);
                timeTotal += AssemblyUtility.GetTime(() =>
                {
                    stream.Seek(posision, SeekOrigin.Begin);
                    work(randomArray, 0, randomArray.Length);
                });
            }
            return timeTotal;
        }
        protected override TimeSpan DoBenchmarkAlgorithm(FileStream stream, Action<byte[], int, int> work, BenchmarkFlags flags, CancellationToken cancellationToken)
        {
            var randomBenchmarkTimeTotal = new TimeSpan(0);
            for (int i = 0; i < BlockCount; i++)
            {
                cancellationToken.ThrowIfCancellationRequested();   //可以取消

                var randomArray = AssemblyUtility.GetData(BlockSize, flags.HasFlag(BenchmarkFlags.Compressible));
                long posision = BlockSize * this.RandomGen.Next(BlockCount);
                randomBenchmarkTimeTotal += AssemblyUtility.GetTime(() =>
                {
                    stream.Seek(posision, SeekOrigin.Begin);
                    work(randomArray, 0, randomArray.Length);
                });

                var blockCountIn60S = (double)i / randomBenchmarkTimeTotal.Ticks * 60;
                this.BlockCountValue = (int)Min(this.BlockCountValue, Max(Max(i, EvalutionCount), blockCountIn60S));
            }
            return randomBenchmarkTimeTotal;
        }