2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 22:48:42 +00:00
This commit is contained in:
2026-06-09 01:40:29 +03:00
parent 2bdd5d5022
commit a741013621
19 changed files with 887 additions and 185 deletions
+11 -8
View File
@@ -16,7 +16,10 @@ public class GrpcTest
public static async Task<TestResults> DoTest(string address,
Dictionary<string, BusinessDocument[]> docsWorkloads,
Dictionary<string, byte[]> dataWorkloads,
Dictionary<string, int[]> intWorkloads)
Dictionary<string, int[]> intWorkloads,
int warmupDelayMs = 3000,
int postHandshakeDelayMs = 2000,
int sampleDelayMs = 3000)
{
var rt = new TestResults();
@@ -29,13 +32,13 @@ public class GrpcTest
var service = new Client.Grpc.EchoService.EchoServiceClient(channel);
Thread.Sleep(3000);
Thread.Sleep(warmupDelayMs);
var (tx, rx, ctx, crx) = mon.GetDiff(0, 0);
Console.WriteLine($"Handshake {ctx}/{crx}");
await Task.Delay(2000);
await Task.Delay(postHandshakeDelayMs);
foreach (var w in docsWorkloads)
{
@@ -50,7 +53,7 @@ public class GrpcTest
// throw new Exception("No match");
await Task.Delay(3000);
await Task.Delay(sampleDelayMs);
(tx, rx, ctx, crx) = mon.GetDiff(tx, rx);
Console.WriteLine($", {tx}/{rx}, {ctx}/{crx}");
@@ -72,7 +75,7 @@ public class GrpcTest
// throw new Exception("No match");
await Task.Delay(3000);
await Task.Delay(sampleDelayMs);
(tx, rx, ctx, crx) = mon.GetDiff(tx, rx);
Console.WriteLine($", {tx}/{rx}, {ctx}/{crx}");
//Console.WriteLine($"Socket {sock.BytesSent}/{sock.BytesReceived}");
@@ -96,7 +99,7 @@ public class GrpcTest
// throw new Exception("No match");
await Task.Delay(3000);
await Task.Delay(sampleDelayMs);
(tx, rx, ctx, crx) = mon.GetDiff(tx, rx);
Console.WriteLine($", {tx}/{rx}, {ctx}/{crx}");
//Console.WriteLine($"Socket {sock.BytesSent}/{sock.BytesReceived}");
@@ -105,7 +108,7 @@ public class GrpcTest
}
await Task.Delay(3000);
await Task.Delay(sampleDelayMs);
(tx, rx) = mon.GetTotals();
Console.WriteLine($"Transfer {tx}/{rx}");
@@ -115,4 +118,4 @@ public class GrpcTest
return rt;
}
}
}