Beispiel #1
0
        public async Task JobContinueAsync(int numRPCBytes,
                                           long rep,
                                           BoxedDateTime startTimeOfRoundBoxed)
        {
            var startTimeOfRound       = startTimeOfRoundBoxed.val;
            var bytesSentInCurrentCall = 0;

            for (; _numRoundsLeft > 0; _numRoundsLeft--)
            {
                var RPCbuf = new byte[numRPCBytes];
                for (int i = 0; i < RPCbuf.Length; i++)
                {
                    RPCbuf[i] = (byte)i;
                }
                long iterations = ((long)1 * 1024 * 1024 * 1024) / numRPCBytes;
                if (rep == 0)
                {
                    startTimeOfRound = DateTime.Now;
                }
                for (; rep < iterations; rep++)
                {
                    if (bytesSentInCurrentCall > 10 * 1024 * 1024)
                    {
                        var newStartTimeOfRoundBoxed = new BoxedDateTime();
                        newStartTimeOfRoundBoxed.val = startTimeOfRound;
                        thisProxy.JobContinueFork(numRPCBytes, rep, newStartTimeOfRoundBoxed);
                        return;
                    }
                    bytesSentInCurrentCall += numRPCBytes;
                    _callNum++;
                    StreamCommunicator.WriteLong(RPCbuf, 0, _callNum);
                    _server.MFork(RPCbuf);
                }
                var    endTimeOfRound        = DateTime.Now;
                var    roundDuration         = endTimeOfRound - startTimeOfRound;
                long   numberOfBytesSent     = iterations * numRPCBytes;
                double numberOfGigabytesSent = ((double)numberOfBytesSent) / ((double)oneGig);
                rep = 0;
                Console.WriteLine("*X* {0}\t{1}",
                                  numRPCBytes,
                                  numberOfGigabytesSent / roundDuration.TotalSeconds
                                  );
                if (_descendingSize)
                {
                    if (numRPCBytes > 16)
                    {
                        numRPCBytes >>= 1;
                    }
                }
                else
                {
                    int Choices = (int)Math.Log(_maxMessageSize, 2);
                    int Choice  = _randGenerator.Next(4, Choices);
                    numRPCBytes = 1 << Choice;
                }
            }
            _server.PrintBytesReceivedFork();
        }
Beispiel #2
0
        protected async Task <bool> RunAsync()
        {
            long totalBytesSent = 0;

            double totalGBSentEntireTest = 0;
            double totalSecsEntireTest   = 0;
            double runningAvg            = 0;

            Console.WriteLine("*X* {0}\t{1}", "Bytes per RPC", "Throughput (GB/sec)");
            var sw = new Stopwatch();

            for (var numRPCBytes = 64 * 1024; numRPCBytes >= 16; numRPCBytes >>= 1)
            {
                var RPCbuf = new byte[numRPCBytes];
                for (int i = 0; i < RPCbuf.Length; i++)
                {
                    RPCbuf[i] = (byte)i;
                }
                long iterations = ((long)1 * 1024 * 1024 * 1024) / numRPCBytes;
                sw.Restart();
                for (var rep = 0; rep < iterations; rep++)
                {
                    totalBytesSent += numRPCBytes;
                    _callNum++;
                    StreamCommunicator.WriteLong(RPCbuf, 0, _callNum);
                    var result = await this._server.MAsync(RPCbuf);

                    _bytesReceived += result.Length;
                    var curCallNum = StreamCommunicator.ReadBufferedLong(result, 0);
                    if (_callNum != curCallNum)
                    {
                        Console.WriteLine("*X* Out of order message. Expected {0}, got {1}", _callNum, curCallNum);
                    }
                }

                sw.Stop();
                var numberOfBytesSent     = iterations * numRPCBytes;
                var numberOfGigabytesSent = ((double)numberOfBytesSent) / ((double)OneGig);
                var totalSeconds          = (double)sw.Elapsed.TotalSeconds;

                totalGBSentEntireTest = totalGBSentEntireTest + numberOfGigabytesSent;
                totalSecsEntireTest   = totalSecsEntireTest + totalSeconds;

                Console.WriteLine("*X* {0}\t{1}",
                                  numRPCBytes,
                                  numberOfGigabytesSent / totalSeconds
                                  );

                runningAvg = totalGBSentEntireTest / totalSecsEntireTest;
            }
            Console.WriteLine("*X* ---------- Summary -------------");
            Console.WriteLine("*X* - Total GBs Sent:" + totalGBSentEntireTest);
            Console.WriteLine("*X* - Total Time (secs):" + totalSecsEntireTest);
            Console.WriteLine("*X* - Throughput (GB/Sec):" + runningAvg);
            Console.WriteLine("--------------------------------");
            this._server.PrintBytesReceivedFork();
            return(true);
        }
Beispiel #3
0
        public async Task MAsync(byte[] arg)
        {
            _bytesReceived += arg.Length;
            if ((_bytesReceived - arg.Length) / oneGig != _bytesReceived / oneGig)
            {
                Console.WriteLine($"Service Received {_bytesReceived / (1024 * 1024)} MB so far");
            }
            var curCallNum = StreamCommunicator.ReadBufferedLong(arg, 0);

            if (_lastCallNum + 1 != curCallNum)
            {
//                Console.WriteLine("*X* Out of order message. Expected {0}, got {1}", _lastCallNum + 1, curCallNum);
            }
            _lastCallNum = curCallNum;
        }
Beispiel #4
0
        public async Task <byte[]> MAsync(byte[] arg)
        {
            bytesReceived += arg.Length;
            var curCallNum = StreamCommunicator.ReadBufferedLong(arg, 0);

            if (_lastCallNum + 1 != curCallNum)
            {
                Console.WriteLine("*X* Out of order message. Expected {0}, got {1}", _lastCallNum + 1, curCallNum);
            }
            _lastCallNum = curCallNum;
            if ((bytesReceived - arg.Length) / oneGig != bytesReceived / oneGig)
            {
                Console.WriteLine($"*X* Received {bytesReceived / oneMB} MB so far");
                //this.thisProxy.PrintMessageFork("hey!", 3.14);
            }

            return(arg);
        }
Beispiel #5
0
        public async Task MAsync(byte[] arg)
        {
            _bytesReceived += arg.Length;
            if ((_bytesReceived - arg.Length) / oneGig != _bytesReceived / oneGig)
            {
                Console.WriteLine($"Received {_bytesReceived / oneMB} MB so far");
            }
            var curCallNum = StreamCommunicator.ReadBufferedLong(arg, 0);

            if (_numJobs == 1 && _lastCallNum + 1 != curCallNum)
            {
                Console.WriteLine("*X* Out of order message. Expected {0}, got {1}", _lastCallNum + 1, curCallNum);
            }
            _lastCallNum = curCallNum;
            if (_isBidirectional)
            {
                for (int i = 0; i < _numJobs; i++)
                {
                    _jobs[i].MFork(arg);
                }
            }
        }