mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-29 06:48:41 +00:00
TryRegisterTypeDef
This commit is contained in:
@@ -21,7 +21,6 @@ using Esiur.Protocol;
|
||||
using Esiur.Resource;
|
||||
using Esiur.Stores;
|
||||
using System.Diagnostics;
|
||||
|
||||
var mode = GetArg(args, "--mode", "both");
|
||||
var host = GetArg(args, "--host", "127.0.0.1");
|
||||
var port = int.Parse(GetArg(args, "--port", "10902"));
|
||||
@@ -83,6 +82,8 @@ for (int round = 0; round < rounds; round++)
|
||||
|
||||
var roundSw = Stopwatch.StartNew();
|
||||
|
||||
var connnection = await clientWh.Get<EpConnection>($"ep://{host}:{port}");
|
||||
|
||||
// Fire all attachments simultaneously
|
||||
var tasks = targets.Select((resourceIdx, taskIdx) => Task.Run(async () =>
|
||||
{
|
||||
@@ -90,8 +91,7 @@ for (int round = 0; round < rounds; round++)
|
||||
using var cts = new CancellationTokenSource(timeoutMs);
|
||||
try
|
||||
{
|
||||
var proxy = await clientWh.Get<IResource>(
|
||||
$"ep://{host}:{port}/sys/sensor_{resourceIdx}");
|
||||
var proxy = await connnection.Get($"sys/sensor_{resourceIdx}");
|
||||
|
||||
sw.Stop();
|
||||
latencies[taskIdx] = sw.Elapsed.TotalMilliseconds;
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
using Esiur.Protocol;
|
||||
using Esiur.Resource;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
var host = GetArg(args, "--host", "127.0.0.1");
|
||||
var port = int.Parse(GetArg(args, "--port", "10901"));
|
||||
var resourceCount = int.Parse(GetArg(args, "--resources", "10000"));
|
||||
var batchSize = int.Parse(GetArg(args, "--batch", "100"));
|
||||
var batchSize = int.Parse(GetArg(args, "--batch", "10000"));
|
||||
|
||||
Console.WriteLine($"[Client-T2] Connecting to {host}:{port}, resources={resourceCount}");
|
||||
|
||||
@@ -29,6 +30,7 @@ var proxies = new IResource[resourceCount];
|
||||
|
||||
// --- Attach in batches to avoid overwhelming the runtime -------------
|
||||
var totalSw = Stopwatch.StartNew();
|
||||
|
||||
for (int batch = 0; batch < resourceCount; batch += batchSize)
|
||||
{
|
||||
|
||||
@@ -41,8 +43,12 @@ for (int batch = 0; batch < resourceCount; batch += batchSize)
|
||||
batchTasks[i - batch] = Task.Run(async () =>
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
||||
Console.WriteLine(capturedI);
|
||||
proxies[capturedI] = await connnection.Get($"sys/sensor_{capturedI}");
|
||||
|
||||
Console.WriteLine(proxies[capturedI].Instance.Link);
|
||||
|
||||
sw.Stop();
|
||||
|
||||
lock (attachLatencies)
|
||||
@@ -77,7 +83,7 @@ Console.WriteLine("[Client-T2] Measuring notification latency under full resourc
|
||||
long received = 0;
|
||||
double sumLatencyMs = 0;
|
||||
|
||||
for (int i = 0; i < Math.Min(500, resourceCount); i++)
|
||||
for (int i = 0; i < resourceCount; i++)
|
||||
{
|
||||
int capturedI = i;
|
||||
proxies[capturedI].Instance.PropertyModified += (PropertyModificationInfo data) =>
|
||||
|
||||
Reference in New Issue
Block a user