Beispiel #1
0
        Measurement DoOneEncodeMeasurement(ReedSolomon codec, BufferSet[] bufferSets)
        {
            long passesCompleted = 0;
            long bytesEncoded    = 0;
            long encodingTime    = 0;

            while (encodingTime < MEASUREMENT_DURATION)
            {
                BufferSet bufferSet = bufferSets[nextBuffer];
                nextBuffer = (nextBuffer + 1) % bufferSets.Length;
                byte[][] shards    = bufferSet.Buffers;
                DateTime startTime = DateTime.UtcNow;
                codec.EncodeParity(shards, 0, BUFFER_SIZE);
                DateTime endTime = DateTime.UtcNow;
                encodingTime    += (long)(endTime - startTime).TotalMilliseconds;
                bytesEncoded    += BUFFER_SIZE * DATA_COUNT;
                passesCompleted += 1;
            }

            double seconds   = encodingTime / 1000.0;
            double megabytes = bytesEncoded / 1000000.0;
            var    result    = new Measurement(megabytes, seconds);

            Console.WriteLine("        {0} passes, {1}", passesCompleted, result);

            return(result);
        }