public void TestOverflowDispatch() { var testResults = new TestResults(); var countTaker = World.ActorFor <ICountTaker>( Definition.Has <CountTakerActor>( Definition.Parameters(testResults), "testRingMailbox", "countTaker-2")); var totalCount = MailboxSize * 2; testResults.Until = Until(MaxCount); for (var count = 1; count <= totalCount; ++count) { countTaker.Take(count); } testResults.Until.Completes(); Assert.Equal(MaxCount, testResults.Highest.Get()); }
public void TestBasicDispatch() { const int mailboxSize = 64; var testResults = new TestResults(mailboxSize); var dispatcher = new RingBufferDispatcher(mailboxSize, 2, false, 4); dispatcher.Start(); var mailbox = dispatcher.Mailbox; var actor = new CountTakerActor(testResults); for (var count = 1; count <= mailboxSize; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); mailbox.Send(actor, consumer, null, "Take(int)"); } Assert.Equal(mailboxSize, testResults.GetHighest()); }
public void TestBasicDispatch() { Init(MailboxSize); var testResults = new TestResults(); var countTaker = World.ActorFor <ICountTaker>( Definition.Has <CountTakerActor>( Definition.Parameters(testResults), "testRingMailbox", "countTaker-1")); var totalCount = MailboxSize / 2; testResults.Until = Until(MaxCount); testResults.maximum = MaxCount; for (var count = 1; count <= totalCount; ++count) { countTaker.Take(count); } testResults.Until.Completes(); Assert.Equal(MaxCount, testResults.highest); }
public void TestThroughput() { Init(ThroughputMailboxSize); var testResults = new TestResults(); var countTaker = World.ActorFor <ICountTaker>( Definition.Has <ThroughputCountTakerActor>( Definition.Parameters(testResults), "testRingMailbox", "countTaker-2")); testResults.maximum = ThroughputWarmUpCount; for (var count = 1; count <= ThroughputWarmUpCount; ++count) { countTaker.Take(count); } while (testResults.highest < ThroughputWarmUpCount) { } testResults.highest = 0; testResults.maximum = ThroughputMaxCount; var startTime = DateTime.UtcNow; for (int count = 1; count <= ThroughputMaxCount; ++count) { countTaker.Take(count); } while (testResults.highest < ThroughputMaxCount) { } var timeSpent = DateTime.UtcNow - startTime; Console.WriteLine("Ms: " + timeSpent.TotalMilliseconds + " FOR " + ThroughputMaxCount + " MESSAGES IS " + (ThroughputMaxCount / timeSpent.TotalSeconds) + " PER SECOND"); Assert.Equal(ThroughputMaxCount, testResults.highest); }
public void TestOverflowDispatch() { var testResults = new TestResults(); const int mailboxSize = 64; const int overflowSize = mailboxSize * 2; var dispatcher = new RingBufferDispatcher(mailboxSize, 2, 4); var mailbox = dispatcher.Mailbox; var actor = new CountTakerActor(testResults); testResults.Until = Until(overflowSize); for (var count = 1; count <= overflowSize; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); mailbox.Send(actor, consumer, null, "Take(int)"); } dispatcher.Start(); testResults.Until.Completes(); Assert.Equal(overflowSize, testResults.Highest.Get()); }
public void TestBasicDispatch() { var testResults = new TestResults(); const int mailboxSize = 64; var dispatcher = new RingBufferDispatcher(mailboxSize, 2, 4); dispatcher.Start(); var mailbox = dispatcher.Mailbox; var actor = new CountTakerActor(testResults); testResults.Until = Until(mailboxSize); for (var count = 1; count <= mailboxSize; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); var message = new LocalMessage <ICountTaker>(actor, consumer, "Take(int)"); mailbox.Send(message); } testResults.Until.Completes(); Assert.Equal(mailboxSize, testResults.Highest.Get()); }
public CountTakerActor(TestResults testResults) { this.testResults = testResults; }
public OneBehaviorActor(TestResults results) { this.results = results; }
public ThroughputCountTakerActor(TestResults testResults) { this.testResults = testResults; }
public CountTakerActor(TestResults testResults) { this.testResults = testResults; self = SelfAs <ICountTaker>(); }
public CountTakerActor(TestResults testResults) { _testResults = testResults; _self = SelfAs <ICountTaker>(); }
public ThroughputCountTakerActor(TestResults testResults) => _testResults = testResults;