Exemplo n.º 1
0
        public void MeasureTransactionOverhead()
        {
            _output.WriteLine("Transaction overhead measuring");

            int sentCounter     = _channel.BytesSent;
            int receivedCounter = _channel.BytesReceived;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            int iterationsCount = 100000;

            for (int i = 0; i < iterationsCount; i++)
            {
                _proxy.AskForTrue();
            }

            sw.Stop();
            _output.WriteLine($"    Delay: {(sw.ElapsedMilliseconds * 1000) / (double)iterationsCount} microseconds");
            _output.WriteLine($"    Ticks: { sw.ElapsedTicks / iterationsCount}");
            _output.WriteLine($"    Sent by client per transaction: {(_channel.BytesSent - sentCounter) / (double)iterationsCount} b");
            _output.WriteLine($"    Received by client per transaction: {(_channel.BytesReceived - receivedCounter) / (double)iterationsCount} b");
        }