public void RegisterActionAsync() { using var pool = new LogicLooperPool(60, 4, RoundRobinLogicLooperPoolBalancer.Instance); var actionCount = 50000; var loopCount = 10; var executedCount = 0; Parallel.For(0, actionCount, _ => { var loop = 0; pool.RegisterActionAsync((in LogicLooperActionContext ctx) => { Interlocked.Increment(ref executedCount); return(++loop < loopCount); });
public void LogicLooperPool_Stress_1(int targetFps, int actionCount, int loopCount) { using var pool = new LogicLooperPool(targetFps, 4, RoundRobinLogicLooperPoolBalancer.Instance); var executedCount = 0; var launchedCount = 0; var begin = DateTime.Now; Parallel.For(0, actionCount, _ => { var firstTime = true; var loop = 0; pool.RegisterActionAsync((in LogicLooperActionContext ctx) => { if (firstTime) { Interlocked.Increment(ref launchedCount); firstTime = false; } Interlocked.Increment(ref executedCount); return(++loop < loopCount); });
public void Create_TimeSpan() { using var pool = new LogicLooperPool(TimeSpan.FromMilliseconds(16.666), 4, RoundRobinLogicLooperPoolBalancer.Instance); pool.Loopers.Should().HaveCount(4); pool.Loopers[0].TargetFrameRate.Should().BeInRange(60, 60.1); }
public void Create() { using var pool = new LogicLooperPool(60, 4, RoundRobinLogicLooperPoolBalancer.Instance); pool.Loopers.Should().HaveCount(4); pool.Loopers[0].TargetFrameRate.Should().BeInRange(60, 60.1); }