• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NBench.BenchmarkContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NBench.BenchmarkContext的典型用法代码示例。如果您正苦于以下问题:C# BenchmarkContext类的具体用法?C# BenchmarkContext怎么用?C# BenchmarkContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BenchmarkContext类属于NBench命名空间,在下文中一共展示了BenchmarkContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Setup

        public void Setup(BenchmarkContext context)
        {
            _actorSystem = ActorSystem.Create("FileSourcesBenchmark");
            _materializer = _actorSystem.Materializer();

            _file = CreateFile();

            _fileChannelSource = FileIO.FromFile(_file, BufferSize);
            _fileInputStreamSource = StreamConverters.FromInputStream(() => File.OpenRead(_file.FullName), BufferSize);
            _ioSourceLinesIterator = Source.FromEnumerator(() => File.ReadLines(_file.FullName).Select(ByteString.FromString).GetEnumerator());
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:11,代码来源:FileSourcesBenchmark+.cs


示例17: TearDown

 public void TearDown(BenchmarkContext context)
 {
     var shutdownTimeout = TimeSpan.FromSeconds(5);
     try
     {
         _sys?.Terminate().Wait(shutdownTimeout);
     }
     catch (Exception ex)
     {
         context.Trace.Error(ex, $"failed to shutdown actorsystem within {shutdownTimeout}");
     }
 }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:12,代码来源:AskSpec.cs


示例18: PerfSetUp

 public void PerfSetUp(BenchmarkContext context)
 {
     benchmarkCounter = context.GetCounter(MessagesReceivedCounter);
     StartServer((data, channel) =>
     {
         benchmarkCounter.Increment();
         var serverReceived = ServerReceived.GetAndIncrement();
         if (serverReceived >= MessageCount - 1)
             _resentEvent.Set();
     });
     StartClient();
     message = new byte[MessageLength];
 }
开发者ID:helios-io,项目名称:helios,代码行数:13,代码来源:SocketThroughputSpec.cs


示例19: Setup

        public void Setup(BenchmarkContext context)
        {
            MsgReceived = context.GetCounter("MsgReceived");
            System = ActorSystem.Create("PerfSys", Config);
            Action<IActorDsl> actor = d => d.ReceiveAny((o, c) =>
            {
                MsgReceived.Increment();
            });
            TestActor = System.ActorOf(Props.Create(() => new Act(actor)).WithDispatcher("calling-thread-dispatcher"), "testactor");

            // force initialization of the actor
            TestActor.Tell("warmup");
            MsgReceived.Decrement();
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:14,代码来源:MessageDispatchAndReceiveBenchmark.cs


示例20: Setup

        public void Setup(BenchmarkContext context)
        {
            MsgReceived = context.GetCounter("MsgReceived");
            System = ActorSystem.Create("PerfSys");
            Action<IActorDsl> actor = d => d.ReceiveAny((o, c) =>
            {
                MsgReceived.Increment();
            });
            TestActor = System.ActorOf(Props.Create(() => new Act(actor)), "testactor");
            var id = TestActor.Ask<ActorIdentity>(new Identify(null), TimeSpan.FromSeconds(3)).Result;

            Mailbox = new Mailbox(new UnboundedMessageQueue());
            Mailbox.SetActor(TestActor.AsInstanceOf<RepointableActorRef>().Underlying.AsInstanceOf<ActorCell>());
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:14,代码来源:MailboxBenchmarks.cs



注:本文中的NBench.BenchmarkContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NBitcoin.Op类代码示例发布时间:2022-05-26
下一篇:
C# Model.DataNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap