本文整理汇总了C#中NBench.BenchmarkContext类的典型用法代码示例。如果您正苦于以下问题:C# BenchmarkContext类的具体用法?C# BenchmarkContext怎么用?C# BenchmarkContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BenchmarkContext类属于NBench命名空间,在下文中一共展示了BenchmarkContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewActorSelectionOnNewActorThroughput
public void NewActorSelectionOnNewActorThroughput(BenchmarkContext context)
{
var actorRef = System.ActorOf(_oneMessageBenchmarkProps); // create a new actor every time
System.ActorSelection(actorRef.Path).Tell("foo"); // send that actor a message via selection
_resetEvent.Wait();
_resetEvent.Reset();
}
示例2: OneWayThroughputBenchmark
public void OneWayThroughputBenchmark(BenchmarkContext context)
{
for (var i = 0; i < MessageCount; i++)
{
Send(message);
}
_resentEvent.Wait();
}
示例3: UntypedActorMemoryFootprint
public void UntypedActorMemoryFootprint(BenchmarkContext context)
{
for (var i = 0; i < ActorCreateNumber; i++)
{
_system.ActorOf(UntypedActorProps);
_createActorThroughput.Increment();
}
}
示例4: Setup
public void Setup(BenchmarkContext context)
{
_selectionOpCounter = context.GetCounter(ActorSelectionCounterName);
System = ActorSystem.Create("MailboxThroughputSpecBase" + Counter.GetAndIncrement());
_receiver = System.ActorOf(Props.Create(() => new BenchmarkActor(_selectionOpCounter, NumberOfMessages, _resetEvent)));
_receiverActorPath = _receiver.Path;
_oneMessageBenchmarkProps = Props.Create(() => new BenchmarkActor(_selectionOpCounter, 1, _resetEvent));
}
示例5: AddThroughput_IterationsMode
public void AddThroughput_IterationsMode(BenchmarkContext context)
{
for (var i = 0; i < AcceptableMinAddThroughput; i++)
{
dictionary.Add(i, i);
addCounter.Increment();
}
}
示例6: SetUp
public void SetUp(BenchmarkContext context)
{
_inboundThroughputCounter = context.GetCounter(InboundThroughputCounterName);
_counterHandlerInbound = new CounterHandlerInbound(_inboundThroughputCounter);
_outboundThroughputCounter = context.GetCounter(OutboundThroughputCounterName);
_counterHandlerOutbound = new CounterHandlerOutbound(_outboundThroughputCounter);
channel = new EmbeddedChannel(_counterHandlerOutbound, _counterHandlerInbound);
}
示例7: FiberThroughputSingleDelegate
public void FiberThroughputSingleDelegate(BenchmarkContext context)
{
for (var i = 0; i < ExecutorOperations;)
{
_executor.Execute(Operation);
++i;
}
SpinWait.SpinUntil(() => eventCount.Current >= ExecutorOperations, TimeSpan.FromSeconds(3));
}
示例8: Setup
public void Setup(BenchmarkContext context)
{
_counter = context.GetCounter("TestCounter");
var fixture = new Fixture();
fixture.RepeatCount = 100;
_list = fixture.Create<List<string>>();
_algorithm = new Algorithm1();
}
示例9: ConcurrentCircularBufferWithResizing
public void ConcurrentCircularBufferWithResizing(BenchmarkContext context)
{
for (var i = 0; i < ResizedItemCount;)
{
concurrentCircularBuffer.Add(i);
_insertsCounter.Increment();
++i;
}
}
示例10: Setup
public void Setup(BenchmarkContext context)
{
_actorSystem = ActorSystem.Create("MaterializationBenchmark",
ConfigurationFactory.FromResource<AkkaSpec>("Akka.Streams.TestKit.Tests.reference.conf"));
_actorSystem.Settings.InjectTopLevelFallback(ActorMaterializer.DefaultConfig());
_materializerSettings =
ActorMaterializerSettings.Create(_actorSystem).WithDispatcher("akka.test.stream-dispatcher");
_materializer = _actorSystem.Materializer(_materializerSettings);
}
示例11: Setup
public void Setup(BenchmarkContext context)
{
_createMailboxThroughput = context.GetCounter(CreateThroughputCounter);
_mailboxes = new List<Mailbox>(MailboxCreateNumber);
_unboundedMailboxType = new UnboundedMailbox();
_boundedMailboxType = new BoundedMailbox(_actorSystem.Settings, MailboxConfig);
_unboundedDequeBasedMailboxType = new UnboundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
_boundedDequeBasedMailboxType = new BoundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
}
示例12: Benchmark
public void Benchmark(BenchmarkContext context)
{
for (var i = 0; i < MailboxMessageCount;)
{
_receiver.Tell(string.Empty);
++i;
}
_resetEvent.Wait(); //wait up to a second
}
示例13: FiberThroughputDynamicDelegate
public void FiberThroughputDynamicDelegate(BenchmarkContext context)
{
for (var i = 0; i < FiberOperations;)
{
_fiber.Add(() => Operation());
++i;
}
SpinWait.SpinUntil(() => eventCount.Current >= FiberOperations, TimeSpan.FromSeconds(3));
}
示例14: MemoryFootprint
public void MemoryFootprint(BenchmarkContext context)
{
var actorPaths = new Address[100000];
for (var i = 0; i < 100000;)
{
actorPaths[i] = new Address("akka", "foo", "localhost", 9091);
++i;
_parseThroughput.Increment();
}
}
示例15: ReusedActorSelectionOnPreExistingActorThroughput
public void ReusedActorSelectionOnPreExistingActorThroughput(BenchmarkContext context)
{
var actorSelection = System.ActorSelection(_receiverActorPath);
for (var i = 0; i < NumberOfMessages;)
{
actorSelection.Tell("foo");
++i;
}
_resetEvent.Wait();
}