Exemplo n.º 1
0
        public async Task Throughput_GetRemainingHealth(int messageCount)
        {
            IFighter <bool> fighter = new Fighter();
            IFighter <bool> proxy   = _directory.AsAddress(fighter);

            Stopwatch watch = Stopwatch.StartNew();

            watch.Reset();

            await proxy.GetRemainingHealth();

            watch.Stop();

            _output.WriteLine("COLD (1 message to warm it up) => ");
            _output.WriteLine($"{((1 / watch.Elapsed.TotalMilliseconds) * 1000.0):0.000} msg/s");
            _output.WriteLine("");

            watch.Restart();

            for (var i = 0; i < messageCount; i++)
            {
                await proxy.GetRemainingHealth();
            }

            watch.Stop();

            _output.WriteLine("");
            _output.WriteLine($"HOT ({messageCount:N0} messages) => ");
            _output.WriteLine($"{((messageCount / watch.Elapsed.TotalMilliseconds) * 1000.0):N2} msg/s");
            _output.WriteLine("");
        }
Exemplo n.º 2
0
        public async Task CodeGenValueTask()
        {
            int messageCount = Messages;

            for (var i = 0; i < messageCount; i++)
            {
                await _codegenProxy.GetRemainingHealth();
            }
        }
Exemplo n.º 3
0
        public async Task NativeValueTask()
        {
            int messageCount = Messages;

            for (var i = 0; i < messageCount; i++)
            {
                await _staticProxy.GetRemainingHealth();
            }
        }