當前位置: 首頁>>代碼示例>>C#>>正文


C# NBench.BenchmarkContext類代碼示例

本文整理匯總了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();
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:7,代碼來源:ActorSelectionSpecs.cs

示例2: OneWayThroughputBenchmark

 public void OneWayThroughputBenchmark(BenchmarkContext context)
 {
     for (var i = 0; i < MessageCount; i++)
     {
         Send(message);
     }
     _resentEvent.Wait();
 }
開發者ID:helios-io,項目名稱:helios,代碼行數:8,代碼來源:SocketThroughputSpec.cs

示例3: UntypedActorMemoryFootprint

 public void UntypedActorMemoryFootprint(BenchmarkContext context)
 {
     for (var i = 0; i < ActorCreateNumber; i++)
     {
         _system.ActorOf(UntypedActorProps);
         _createActorThroughput.Increment();
     }
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:8,代碼來源:ActorMemoryFootprintSpec.cs

示例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));
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:8,代碼來源:ActorSelectionSpecs.cs

示例5: AddThroughput_IterationsMode

 public void AddThroughput_IterationsMode(BenchmarkContext context)
 {
     for (var i = 0; i < AcceptableMinAddThroughput; i++)
     {
         dictionary.Add(i, i);
         addCounter.Increment();
     }
 }
開發者ID:kostasgrevenitis,項目名稱:dotnetalgorithms,代碼行數:8,代碼來源:DictionaryThroughputTests.cs

示例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);
        }
開發者ID:helios-io,項目名稱:helios,代碼行數:9,代碼來源:EmbeddedChannelPerfSpecs.cs

示例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));
 }
開發者ID:helios-io,項目名稱:helios,代碼行數:9,代碼來源:EventExecutorSpecs.cs

示例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();
        }
開發者ID:flcdrg,項目名稱:IntelliTestAndUnitTesting,代碼行數:9,代碼來源:AlgorithmPerfSpecs.cs

示例9: ConcurrentCircularBufferWithResizing

 public void ConcurrentCircularBufferWithResizing(BenchmarkContext context)
 {
     for (var i = 0; i < ResizedItemCount;)
     {
         concurrentCircularBuffer.Add(i);
         _insertsCounter.Increment();
         ++i;
     }
 }
開發者ID:helios-io,項目名稱:helios,代碼行數:9,代碼來源:AllCollectionsSpec.cs

示例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);
 }
開發者ID:rogeralsing,項目名稱:akka.net,代碼行數:9,代碼來源:MaterializationBenchmark.cs

示例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);
 }
開發者ID:Micha-kun,項目名稱:akka.net,代碼行數:9,代碼來源:MailboxMemoryFootprintSpec.cs

示例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
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:9,代碼來源:ActorThroughputSpecBase.cs

示例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));
 }
開發者ID:helios-io,項目名稱:helios,代碼行數:9,代碼來源:FiberSpecs.cs

示例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();
     }
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:10,代碼來源:AddressSpec.cs

示例15: ReusedActorSelectionOnPreExistingActorThroughput

 public void ReusedActorSelectionOnPreExistingActorThroughput(BenchmarkContext context)
 {
     var actorSelection = System.ActorSelection(_receiverActorPath);
     for (var i = 0; i < NumberOfMessages;)
     {
         actorSelection.Tell("foo");
         ++i;
     }
     _resetEvent.Wait();
 }
開發者ID:juergenhoetzel,項目名稱:akka.net,代碼行數:10,代碼來源:ActorSelectionSpecs.cs


注:本文中的NBench.BenchmarkContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。