예제 #1
0
 private static void StartSenders(CancellationToken token, Sender[] senders, Task<long>[] senderTasks)
 {
     for (int i = 0; i < senderTasks.Length; ++i)
     {
         senderTasks[i] = senders[i].RunAsync(token);
     }
 }
예제 #2
0
        private Task<long> StartSendersAndReceiver(CancellationToken token, Sender[] senders, ValidatingReceiver receiver, Task<long>[] senderTasks)
        {
            Task<long> receiverTask;
            if (this.sendBeforeReceive)
            {
                StartSenders(token, senders, senderTasks);
                receiverTask = receiver.RunAsync();
            }
            else
            {
                receiverTask = receiver.RunAsync();
                StartSenders(token, senders, senderTasks);
            }

            return receiverTask;
        }
예제 #3
0
        private Sender[] CreateSenders(MemoryChannel channel, int[] sentDataSizes, DataOracle oracle)
        {
            Sender[] senders = new Sender[this.senderCount];
            for (int i = 0; i < senders.Length; ++i)
            {
                int bufferSize = sentDataSizes[i % sentDataSizes.Length];
                byte fill = (byte)(i + 1);
                senders[i] = new Sender(channel, this.logger, bufferSize, fill, new Delay(2, 1));
                oracle.AddPattern(fill, bufferSize);
            }

            return senders;
        }