From 56d82ecdef095ab208603455cc64d1d4bfee5135 Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Thu, 8 May 2025 00:11:24 +0300 Subject: [PATCH] Load test back --- Example.Frontend/Program.cs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Example.Frontend/Program.cs b/Example.Frontend/Program.cs index 07d7ff4..0434e06 100644 --- a/Example.Frontend/Program.cs +++ b/Example.Frontend/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Net; using System.Text; using System.Threading; @@ -120,23 +121,25 @@ class Program Console.WriteLine($"Token state {cts.Token.IsCancellationRequested}"); DemoCheck.TaskCancelation = true; + const int iterations = 10000; + var timer = Stopwatch.StartNew(); + var x = 0; + for (int i = 0; i < iterations; i++) + { + x = loadSingleton.Next(x); + } + + timer.Stop(); + Console.WriteLine("X is {0}", x); + Console.WriteLine("Time : {0}", timer.Elapsed.TotalMilliseconds); + Console.WriteLine($"Time per call: {timer.Elapsed.TotalMilliseconds / iterations} ms"); + frontendBridge.Disconnect(); DemoCheck.Show(); Console.ReadKey(); - // - // const int iterations = 10000; - // var timer = Stopwatch.StartNew(); - // var x = 0; - // for (int i = 0; i < iterations; i++) - // { - // x = loadSingleton.Next(x); - // } - // - // timer.Stop(); - // Console.WriteLine("X is {0}", x); - // Console.WriteLine("Time : {0}", timer.Elapsed.TotalMilliseconds); - // Console.WriteLine($"Time per call: {timer.Elapsed.TotalMilliseconds / iterations} ms"); + + } } \ No newline at end of file