[InlineData(EngineResolver.DefaultIterationTime)] // 500 ms - the default BDN setting
        public void BenchmarksThatRunLongerThanIterationTimeOnlyDuringFirstInvocationAreNotInvokedOncePerIteration(int iterationTime)
        {
            var engineParameters = CreateEngineParameters(
                mainNoUnroll: TimeConsumingOnlyForTheFirstCall,
                mainUnroll: InstantUnroll,
                job: Job.Default.WithIterationTime(TimeInterval.FromMilliseconds(iterationTime)));

            var engine = new EngineFactory().CreateReadyToRun(engineParameters);

            Assert.Equal(1, timesGlobalSetupCalled);
            // the factory should call the benchmark:
            // 1st time with unroll factor to JIT the code
            // one more to check that the Jitting has not dominated the reported time
            // and one more time to JIT the 16 unroll factor case as it turned out that Jitting has dominated the time
            Assert.Equal(1 + 1 + 1, timesIterationSetupCalled);
            Assert.Equal(1 + 1 + 16, timesBenchmarkCalled);
            Assert.Equal(1 + 1 + 16, timesOverheadCalled);
            Assert.Equal(1 + 1 + 1, timesIterationCleanupCalled);                               // 2x for Target
            Assert.Equal(0, timesGlobalCleanupCalled);                                          // cleanup is called as part of dispose

            Assert.False(engine.TargetJob.Run.HasValue(RunMode.InvocationCountCharacteristic)); // we need pilot stage

            Assert.False(engine.TargetJob.Run.HasValue(AccuracyMode.EvaluateOverheadCharacteristic));

            engine.Dispose(); // cleanup is called as part of dispose

            Assert.Equal(1, timesGlobalCleanupCalled);
        }
Beispiel #2
0
        public void ShouldSleep()
        {
            const int slavesCount = 5;
            const int roundsCount = 3;

            using (var timeSource = new MasterTimeSource()
            {
                Quantum = TimeInterval.FromMilliseconds(1000), AdvanceImmediately = false
            })
            {
                var timeSinks = new SimpleTimeSink[slavesCount];
                for (int i = 0; i < slavesCount; i++)
                {
                    timeSinks[i] = new SimpleTimeSink(double.MaxValue);
                    timeSource.RegisterSink(timeSinks[i]);
                }
                var sw = Stopwatch.StartNew();

                // the first round does not increment the time - it just triggers a sync point
                timeSource.Run(roundsCount + 1);

                var after = sw.Elapsed;
                Assert.IsTrue(after.TotalSeconds > roundsCount);
            }
        }
            public Config()
            {
                var summaryStyle = new SummaryStyle(false, SizeUnit.KB, TimeUnit.Millisecond, true);

                this.SummaryStyle = summaryStyle;

                Add(MemoryDiagnoser.Default);
                //Add(
                //	HardwareCounter.BranchInstructions,
                //	//HardwareCounter.CacheMisses,
                //	HardwareCounter.BranchMispredictions
                //);
                Add(
                    Job
                    .Core
                    .With(Runtime.Core)
                    .WithWarmupCount(2)
                    .WithIterationCount(30)
                    .WithIterationTime(TimeInterval.FromMilliseconds(200))
                    .WithLaunchCount(1)
                    .With(new GcMode()
                {
                    Force = false
                })
                    );
            }
Beispiel #4
0
        public static IConfig Create(
            DirectoryInfo artifactsPath,
            ImmutableHashSet <string> mandatoryCategories,
            int?partitionCount = null,
            int?partitionIndex = null,
            Job job            = null)
        {
            if (job is null)
            {
                job = Job.Default
                      .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
                      .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
                      .WithMinIterationCount(15)
                      .WithMaxIterationCount(20)                             // we don't want to run more that 20 iterations
                      .DontEnforcePowerPlan();                               // make sure BDN does not try to enforce High Performance power plan on Windows
            }

            return(DefaultConfig.Instance
                   .With(job.AsDefault())         // tell BDN that this are our default settings
                   .WithArtifactsPath(artifactsPath.FullName)
                   .With(MemoryDiagnoser.Default) // MemoryDiagnoser is enabled by default
                   .With(new OperatingSystemFilter())
                   .With(new PartitionFilter(partitionCount, partitionIndex))
                   .With(JsonExporter.Full) // make sure we export to Json (for BenchView integration purpose)
                   .With(new PerfLabExporter())
                   .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
                   .With(TooManyTestCasesValidator.FailOnError)
                   .With(new UniqueArgumentsValidator()) // don't allow for duplicated arguments #404
                   .With(new MandatoryCategoryValidator(mandatoryCategories)));
        }
        public FullProfileConfig()
        {
            var summaryStyle = new SummaryStyle(false, SizeUnit.KB, TimeUnit.Millisecond, true);

            this.SummaryStyle = summaryStyle;

            Add(
                DisassemblyDiagnoser.Create(
                    new DisassemblyDiagnoserConfig(printAsm: true, printPrologAndEpilog: true, recursiveDepth: 3, printDiff: true)
                    )
                );
            Add(MemoryDiagnoser.Default);
            Add(
                HardwareCounter.BranchInstructions,
                //HardwareCounter.CacheMisses,
                HardwareCounter.BranchMispredictions
                );
            Add(
                Job
                .Core
                .With(Runtime.Core)
                .WithWarmupCount(2)
                .WithIterationCount(10)
                .WithIterationTime(TimeInterval.FromMilliseconds(200))
                .WithLaunchCount(1)
                .With(new GcMode()
            {
                Force = false
            })
                );
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            var p = new Prometheus.MetricServer(12203);

            p.Start();

            var collector = DotNetRuntimeStatsBuilder.Default().StartCollecting();


            var tasks = Enumerable.Range(1, 2_000_000)
                        .Select(_ => Task.Run(() => 1))
                        .ToArray();

            var b  = new byte[1024 * 1000];
            var b2 = new byte[1024 * 1000];
            var b3 = new byte[1024 * 1000];

            Task.WaitAll(tasks);

            Console.WriteLine("Done");
            Console.ReadLine();

            return;

            BenchmarkRunner.Run <TestBenchmark>(
                DefaultConfig.Instance
                .With(
                    Job.Core
                    .WithLaunchCount(1)
                    .WithIterationTime(TimeInterval.FromMilliseconds(200))
                    .With(Platform.X64)
                    .With(Jit.RyuJit)
                    )
                );
        }
        public static IConfig Create(
            DirectoryInfo artifactsPath,
            ImmutableHashSet <string> mandatoryCategories,
            int?partitionCount = null,
            int?partitionIndex = null,
            Job job            = null)
        {
            if (job is null)
            {
                job = Job.Default
                      .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
                      .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
                      .WithMinIterationCount(15)
                      .WithMaxIterationCount(20)                             // we don't want to run more that 20 iterations
                      .DontEnforcePowerPlan();                               // make sure BDN does not try to enforce High Performance power plan on Windows

                // See https://github.com/dotnet/roslyn/issues/42393
                job = job.With(new Argument[] { new MsBuildArgument("/p:DebugType=portable") });
            }

            return(DefaultConfig.Instance
                   .With(job.AsDefault())         // tell BDN that this are our default settings
                   .WithArtifactsPath(artifactsPath.FullName)
                   .With(MemoryDiagnoser.Default) // MemoryDiagnoser is enabled by default
                   .With(new OperatingSystemFilter())
                   .With(new PartitionFilter(partitionCount, partitionIndex))
                   .With(JsonExporter.Full) // make sure we export to Json
                   .With(new PerfLabExporter())
                   .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
                   .With(TooManyTestCasesValidator.FailOnError)
                   .With(new UniqueArgumentsValidator())                         // don't allow for duplicated arguments #404
                   .With(new MandatoryCategoryValidator(mandatoryCategories))
                   .With(SummaryStyle.Default.WithMaxParameterColumnWidth(36))); // the default is 20 and trims too aggressively some benchmark results
        }
Beispiel #8
0
 public static void Main(string[] args)
 {
     BenchmarkRunner.Run <EventCounterParserBenchmark>(
         DefaultConfig.Instance
         .With(
             new Job()
             .With(RunStrategy.Throughput)
             .WithWarmupCount(1)
             .WithIterationTime(TimeInterval.FromMilliseconds(300))
             .WithMaxIterationCount(30)
             .WithCustomBuildConfiguration("Release")
             .WithOutlierMode(OutlierMode.DontRemove)
             )
         .With(MemoryDiagnoser.Default)
         );
     // BenchmarkSwitcher.FromTypes(new []{typeof(BaselineBenchmark), typeof(NoSamplingBenchmark), typeof(DefaultBenchmark)}).RunAllJoined(
     //     DefaultConfig.Instance
     //         .With(
     //             new Job()
     //                 .With(RunStrategy.Monitoring)
     //                 .WithLaunchCount(3)
     //                 .WithWarmupCount(1)
     //                 .WithIterationTime(TimeInterval.FromSeconds(10))
     //                 .WithCustomBuildConfiguration("Release")
     //                 .WithOutlierMode(OutlierMode.DontRemove)
     //         )
     //         .With(MemoryDiagnoser.Default)
     //         .With(HardwareCounter.TotalCycles)
     // );
 }
Beispiel #9
0
 public BenchmarkConfig()
 {
     Add(MemoryDiagnoser.Default);
     Add(Job.Default
         .WithLaunchCount(1)
         .WithIterationTime(TimeInterval.FromMilliseconds(200))
         .WithWarmupCount(5)
         .WithTargetCount(1));
 }
Beispiel #10
0
        public static IConfig Create(
            DirectoryInfo artifactsPath,
            ImmutableHashSet <string> mandatoryCategories,
            int?partitionCount = null,
            int?partitionIndex = null,
            List <string> exclusionFilterValue         = null,
            List <string> categoryExclusionFilterValue = null,
            Job job = null,
            bool getDiffableDisasm = false)
        {
            if (job is null)
            {
                job = Job.Default
                      .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
                      .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
                      .WithMinIterationCount(15)
                      .WithMaxIterationCount(20)                             // we don't want to run more that 20 iterations
                      .DontEnforcePowerPlan();                               // make sure BDN does not try to enforce High Performance power plan on Windows

                // See https://github.com/dotnet/roslyn/issues/42393
                job = job.WithArguments(new Argument[] { new MsBuildArgument("/p:DebugType=portable"), new MsBuildArgument("-bl:benchmarkdotnet.binlog") });
            }

            var config = ManualConfig.CreateEmpty()
                         .WithBuildTimeout(TimeSpan.FromMinutes(10))                     // for slow machines
                         .AddLogger(ConsoleLogger.Default)                               // log output to console
                         .AddValidator(DefaultConfig.Instance.GetValidators().ToArray()) // copy default validators
                         .AddAnalyser(DefaultConfig.Instance.GetAnalysers().ToArray())   // copy default analysers
                         .AddExporter(MarkdownExporter.GitHub)                           // export to GitHub markdown
                         .AddColumnProvider(DefaultColumnProviders.Instance)             // display default columns (method name, args etc)
                         .AddJob(job.AsDefault())                                        // tell BDN that this are our default settings
                         .WithArtifactsPath(artifactsPath.FullName)
                         .AddDiagnoser(MemoryDiagnoser.Default)                          // MemoryDiagnoser is enabled by default
                         .AddFilter(new PartitionFilter(partitionCount, partitionIndex))
                         .AddFilter(new ExclusionFilter(exclusionFilterValue))
                         .AddFilter(new CategoryExclusionFilter(categoryExclusionFilterValue))
                         .AddExporter(JsonExporter.Full) // make sure we export to Json
                         .AddColumn(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
                         .AddValidator(TooManyTestCasesValidator.FailOnError)
                         .AddValidator(new UniqueArgumentsValidator())                            // don't allow for duplicated arguments #404
                         .AddValidator(new MandatoryCategoryValidator(mandatoryCategories))
                         .WithSummaryStyle(SummaryStyle.Default.WithMaxParameterColumnWidth(36)); // the default is 20 and trims too aggressively some benchmark results

            if (Reporter.CreateReporter().InLab)
            {
                config = config.AddExporter(new PerfLabExporter());
            }

            if (getDiffableDisasm)
            {
                config = config.AddDiagnoser(CreateDisassembler());
            }

            return(config);
        }
Beispiel #11
0
 public static IConfig Create(DirectoryInfo artifactsPath, ImmutableHashSet <string> mandatoryCategories)
 => DefaultConfig.Instance
 .With(Job.Default
       .WithWarmupCount(1)
       .WithIterationTime(TimeInterval.FromMilliseconds(250))
       .WithMinIterationCount(15)
       .WithMaxIterationCount(20)
       .AsDefault())
 .WithArtifactsPath(artifactsPath.FullName)
 .With(MemoryDiagnoser.Default)
 .With(JsonExporter.Full)
 .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max);
Beispiel #12
0
        public CustomJob()
        {
            Add(
                Job.RyuJitX64
                .With(Runtime.Core)
                .WithIterationTime(TimeInterval.FromMilliseconds(250)));

            Add(
                Job.LegacyJitX64
                .With(Runtime.Clr)
                .WithIterationTime(TimeInterval.FromMilliseconds(250)));
        }
Beispiel #13
0
        // note: this method currently implements
        // the not-sooner-than behaviour which means
        // that it's guaranteed the timeout event
        // will not trigger earlier than current time
        // plus `virtualMilliseconds` (except for the
        // serialization, in which case the event will
        // be triggered immediately);
        // technically the event is triggered in the synchronization phase,
        // so it might be delayed maximally by the size of the quantum
        public static TimeoutEvent EnqueueTimeoutEvent(this TimeSourceBase timeSource, ulong virtualMilliseconds)
        {
            var timeoutEvent = new TimeoutEvent();
            var when         = timeSource.ElapsedVirtualTime + TimeInterval.FromMilliseconds(virtualMilliseconds);

            timeSource.ExecuteInSyncedState(_ =>
            {
                timeoutEvent.Trigger();
            }, new TimeStamp(when, timeSource.Domain));

            return(timeoutEvent);
        }
Beispiel #14
0
        public CustomJob()
        {
            Add(
                Job.RyuJitX64
                .With(CoreRuntime.Core30)
                .WithIterationTime(TimeInterval.FromMilliseconds(500)));

            Add(
                Job.LegacyJitX64
                .With(ClrRuntime.Net472)
                .WithIterationTime(TimeInterval.FromMilliseconds(500)));
        }
Beispiel #15
0
 private static IConfig GetConfig()
 => DefaultConfig.Instance
 .With(Job.Default
       .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
       .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
       .WithMinIterationCount(15)
       .WithMaxIterationCount(20)                             // we don't want to run more that 20 iterations
       .AsDefault())                                          // tell BDN that this are our default settings
 .With(MemoryDiagnoser.Default)                               // MemoryDiagnoser is enabled by default
 .With(new OperatingSystemFilter())
 .With(JsonExporter.Full)                                     // make sure we export to Json (for BenchView integration purpose)
 .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
 .With(TooManyTestCasesValidator.FailOnError);
            public Config()
            {
                Add(new MemoryDiagnoser());
                //Add(ExecutionValidator.FailOnError);

                //The 'quick and dirty' settings, so it runs a little quicker
                // see benchmarkdotnet FAQ
                Add(Job.Default
                    .WithLaunchCount(1) // benchmark process will be launched only once
                    .WithIterationTime(TimeInterval.FromMilliseconds(400))
                    .WithWarmupCount(3)
                    .WithIterationCount(6));
            }
Beispiel #17
0
        public static void Main(string[] args)
        {
            var config = new ManualConfig();

            config.Add(DefaultConfig.Instance);
            config.Add(Job.Default
                       .WithLaunchCount(1)
                       .WithIterationTime(TimeInterval.FromMilliseconds(500))
                       .WithWarmupCount(3)
                       .WithTargetCount(6)
                       );
            BenchmarkRunner.Run <StringIteration>(config);
        }
Beispiel #18
0
        private static void Main(string[] args)
        {
            var baseJob = Job.Default
                          .WithWarmupCount(1)                                      // 1 warmup is enough for our purpose
                          .WithIterationTime(TimeInterval.FromMilliseconds(250.0)) // the default is 0.5s per iteration
                          .WithIterationCount(20)
                          .WithMaxRelativeError(0.01);

            var jobBefore = baseJob.WithId("Core31").WithRuntime(CoreRuntime.Core31);

            var jobAfter = baseJob.WithId("Core50").WithRuntime(CoreRuntime.Core50);

            var config = DefaultConfig.Instance.AddJob(jobBefore).AddJob(jobAfter).KeepBenchmarkFiles();

            BenchmarkRunner.Run <CpuIdBench>(config);

            // Trace.Listeners.Add(new ConsoleListener());
            //
            // // Console.WriteLine("CPU ID: " + Cpu.GetCurrentCoreId());
            // // var summary = BenchmarkRunner.Run<Benchmark>();
            //
            // var test = new Tests.CalliTests();
            // test.TestDelegate();

            //var offset = UnsafeExTests.Helper<int>.ElemOffset;
            //var size = UnsafeExTests.Helper<int>.ElemSize;
            //Console.WriteLine("Offset: " + offset);
            //Console.WriteLine("Size: " + size);

            //var test = new CompressionTests();

            //Console.WriteLine("----------- Shuffle -----------");
            //test.CouldShuffleUnshuffle();

            //Console.WriteLine("----------- LZ4 -----------");
            //test.Lz4Benchmark();

            //Console.WriteLine("----------- ZSTD -----------");
            //test.ZstdBenchmark();

            //Console.WriteLine("----------- GZip -----------");
            //test.GzipBenchmark();

            //Console.WriteLine("----------- Deflate -----------");
            //test.DeflateBenchmark();

            //Console.WriteLine("\n\n\n-------------------------------");

            // Console.WriteLine("Finished, press enter to exit...");
            //Console.ReadLine();
        }
Beispiel #19
0
#pragma warning disable CA1801 // Review unused parameters
        public static IConfig Create(DirectoryInfo artifactsPath, ImmutableHashSet <string> mandatoryCategories)
#pragma warning restore CA1801 // Review unused parameters
#pragma warning disable CA1062 // Validate arguments of public methods
        => DefaultConfig.Instance
        .With(Job.Default
              .WithWarmupCount(1)
              .WithIterationTime(TimeInterval.FromMilliseconds(250))
              .WithMinIterationCount(15)
              .WithMaxIterationCount(20)
              .AsDefault())
        .WithArtifactsPath(artifactsPath.FullName)
        .With(MemoryDiagnoser.Default)
        .With(JsonExporter.Full)
        .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max);
Beispiel #20
0
        static void Main(string[] args)
        {
            var tasks = Enumerable.Range(1, 2_000_000)
                        .Select(_ => Task.Run(() => 1))
                        .ToArray();

            var b = new byte[1024 * 1000];

            if (args.Length > 0 && args[0] == "metrics")
            {
                var metrics   = App.Metrics.AppMetrics.CreateDefaultBuilder().Build();
                var collector = DotNetRuntimeStatsBuilder.Customize()
                                .WithContentionStats()
                                .WithThreadPoolStats()
                                .WithThreadPoolSchedulingStats();

                if (args.Any(x => x == "jit"))
                {
                    collector.WithJitStats();
                }
                if (args.Any(x => x == "gc"))
                {
                    collector.WithGcStats();
                }

                collector
                .WithDebuggingMetrics(false)
                .StartCollecting(metrics);
            }

            var b2 = new byte[1024 * 1000];
            var b3 = new byte[1024 * 1000];

            Task.WaitAll(tasks);

            Console.WriteLine("Done");

            // return;
            BenchmarkRunner.Run <TestBenchmark>(
                DefaultConfig.Instance
                .With(
                    Job.Default
                    .With(CoreRuntime.Core31)
                    .WithLaunchCount(1)
                    .WithIterationTime(TimeInterval.FromMilliseconds(200))
                    .With(Platform.X64)
                    .With(Jit.RyuJit)
                    )
                );
        }
Beispiel #21
0
 public static IConfig Create(DirectoryInfo artifactsPath, ImmutableHashSet <string> mandatoryCategories)
 => DefaultConfig.Instance
 .With(Job.Default
       .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
       .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
       .WithMinIterationCount(15)
       .WithMaxIterationCount(20)                             // we don't want to run more that 20 iterations
       .AsDefault())                                          // tell BDN that this are our default settings
 .WithArtifactsPath(artifactsPath.FullName)
 .With(MemoryDiagnoser.Default)                               // MemoryDiagnoser is enabled by default
 .With(new OperatingSystemFilter())
 .With(JsonExporter.Full)                                     // make sure we export to Json (for BenchView integration purpose)
 .With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
 .With(TooManyTestCasesValidator.FailOnError)
 .With(new MandatoryCategoryValidator(mandatoryCategories));
Beispiel #22
0
 public Config()
 {
     Add(MemoryDiagnoser.Default);
     Add(
         Job
         .Default
         .WithWarmupCount(2)
         .WithIterationCount(25)
         .WithIterationTime(TimeInterval.FromMilliseconds(100))
         .With(new GcMode()
     {
         Force = false
     })
         .WithLaunchCount(1)
         );
 }
        static void Main()
        {
            var job = Job.Default
                      .WithGcServer(true);

            // in-process
            //job = job.WithToolchain(BenchmarkDotNet.Toolchains.InProcess.NoEmit.InProcessNoEmitToolchain.Instance);

            // limited iterations
            job = job
                  .WithIterationCount(15)
                  .WithIterationTime(TimeInterval.FromMilliseconds(500));

            var config = DefaultConfig.Instance.AddJob(job);

            BenchmarkRunner.Run <SchedulerPerf>(config);
        }
 public Config()
 {
     Add(
         HardwareCounter.BranchInstructions,
         //HardwareCounter.CacheMisses,
         HardwareCounter.BranchMispredictions
         );
     Add(
         Job
         .Default
         .With(Runtime.Core)
         .WithWarmupCount(10)
         .WithIterationCount(25)
         .WithIterationTime(TimeInterval.FromMilliseconds(200))
         .WithLaunchCount(1)
         );
 }
Beispiel #25
0
        public static Threshold Create(ThresholdUnit unit, double value)
        {
            switch (unit)
            {
            case ThresholdUnit.Ratio: return(new RelativeThreshold(value));

            case ThresholdUnit.Nanoseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromNanoseconds(value)));

            case ThresholdUnit.Microseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromMicroseconds(value)));

            case ThresholdUnit.Milliseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromMilliseconds(value)));

            case ThresholdUnit.Seconds: return(new AbsoluteTimeThreshold(TimeInterval.FromSeconds(value)));

            case ThresholdUnit.Minutes: return(new AbsoluteTimeThreshold(TimeInterval.FromMinutes(value)));

            default: throw new ArgumentOutOfRangeException(nameof(unit), unit, null);
            }
        }
            public Config()
            {
                var summaryStyle = new SummaryStyle(false, SizeUnit.KB, TimeUnit.Millisecond, true);

                this.SummaryStyle = summaryStyle;
                Add(MemoryDiagnoser.Default);
                Add(
                    Job
                    .Default
                    .WithWarmupCount(2)
                    .WithIterationCount(25)
                    .WithIterationTime(TimeInterval.FromMilliseconds(200))
                    .With(new GcMode()
                {
                    Force = false
                })
                    .WithLaunchCount(1)
                    );
            }
        public static IConfig Create(DirectoryInfo artifactsPath)
        {
            var job = Job.Default
                      .WithWarmupCount(1)                                    // 1 warmup is enough for our purpose
                      .WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
                      .WithMinIterationCount(15)
                      .WithMaxIterationCount(20);                            // we don't want to run more that 20 iterations

            return(DefaultConfig.Instance
                   .AddLogger(ConsoleLogger.Default)                                         // log output to console
                   .AddExporter(MarkdownExporter.GitHub)                                     // export to GitHub markdown
                   .AddColumnProvider(DefaultColumnProviders.Instance)                       // display default columns (method name, args etc)
                   .AddJob(job.AsDefault())                                                  // tell BDN that this are our default settings
                   .WithArtifactsPath(artifactsPath.FullName)
                   .AddDiagnoser(MemoryDiagnoser.Default)                                    // MemoryDiagnoser is enabled by default
                   .AddExporter(JsonExporter.Full)                                           // make sure we export to Json
                   .AddColumn(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
                   .WithSummaryStyle(SummaryStyle.Default.WithMaxParameterColumnWidth(36))); // the default is 20 and trims too aggressively some benchmark results
        }
Beispiel #28
0
        public static void Main()
        {
            var configuration = ManualConfig.CreateEmpty();

            configuration.AddJob(Job.Default
                                 .WithWarmupCount(1)
                                 .WithIterationTime(TimeInterval.FromMilliseconds(250))
                                 .WithMinIterationCount(15)
                                 .WithMaxIterationCount(20)
                                 .WithToolchain(InProcessEmitToolchain.Instance));
            configuration.AddDiagnoser(MemoryDiagnoser.Default);
            configuration.AddColumnProvider(DefaultConfig.Instance.GetColumnProviders().ToArray());
            configuration.AddLogger(ConsoleLogger.Default);
            configuration.AddExporter(new SimpleBenchmarkExporter());
            configuration.SummaryStyle = SummaryStyle.Default
                                         .WithTimeUnit(TimeUnit.Nanosecond)
                                         .WithSizeUnit(SizeUnit.B);

            BenchmarkRunner.Run <JsonRpcMiddlewareBenchmarks>(configuration);
        }
            public Config()
            {
                var summaryStyle = new SummaryStyle(false, SizeUnit.KB, TimeUnit.Millisecond, true);

                this.SummaryStyle = summaryStyle;

                Add(
                    HardwareCounter.BranchInstructions,
                    //HardwareCounter.CacheMisses,
                    HardwareCounter.BranchMispredictions
                    );
                Add(
                    Job
                    .Default
                    .With(Runtime.Core)
                    .WithWarmupCount(5)
                    .WithIterationCount(10)
                    .WithIterationTime(TimeInterval.FromMilliseconds(100))
                    .WithLaunchCount(1)
                    );
            }
Beispiel #30
0
        public BaselineComparisonConfig()
        {
            this.Options |= ConfigOptions.DisableOptimizationsValidator;

            string deploymentRoot = BenchmarkTests.DeploymentRoot;

            var baseJob = Job.Default
                          .WithLaunchCount(1)
                          .WithWarmupCount(3)
                          .WithMaxIterationCount(100)
                          .WithIterationTime(TimeInterval.FromMilliseconds(100));

            this.Add(baseJob
                     .WithId("baseline")
                     .WithEnvironmentVariable(EnvironmentVariableName,
                                              Path.Combine(deploymentRoot, "baseline", "Python.Runtime.dll"))
                     .WithBaseline(true));
            this.Add(baseJob
                     .WithId("new")
                     .WithEnvironmentVariable(EnvironmentVariableName,
                                              Path.Combine(deploymentRoot, "new", "Python.Runtime.dll")));
        }