mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-06-13 22:48:42 +00:00
a
This commit is contained in:
@@ -15,7 +15,10 @@ public class JsonTest
|
||||
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();
|
||||
|
||||
@@ -28,20 +31,20 @@ public class JsonTest
|
||||
using var http = new HttpClient { BaseAddress = new Uri(address) };
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
Console.Write("Workload: " + w.Key);
|
||||
var docs = await JsonRpcCallAsync(http, "EchoDocuments", w.Value);
|
||||
|
||||
await Task.Delay(3000);
|
||||
await Task.Delay(sampleDelayMs);
|
||||
(tx, rx, ctx, crx) = mon.GetDiff(tx, rx);
|
||||
Console.WriteLine($", {tx}/{rx}, {ctx}/{crx}");
|
||||
|
||||
@@ -62,7 +65,7 @@ public class JsonTest
|
||||
// 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}");
|
||||
@@ -82,7 +85,7 @@ public class JsonTest
|
||||
// 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}");
|
||||
@@ -91,7 +94,7 @@ public class JsonTest
|
||||
|
||||
}
|
||||
|
||||
await Task.Delay(3000);
|
||||
await Task.Delay(sampleDelayMs);
|
||||
|
||||
(tx, rx) = mon.GetTotals();
|
||||
Console.WriteLine($"Transfer {tx}/{rx}");
|
||||
@@ -125,4 +128,4 @@ public class JsonTest
|
||||
using var doc = JsonDocument.Parse(raw);
|
||||
return (doc.RootElement.Clone(), raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user