public DefaultCoreConfig()
        {
            Add(ConsoleLogger.Default);
            Add(MarkdownExporter.GitHub);

            Add(MemoryDiagnoser.Default);
            Add(StatisticColumn.OperationsPerSecond);
            Add(DefaultColumnProviders.Instance);

            Add(JitOptimizationsValidator.FailOnError);

            Add(Job.Core
#if NETCOREAPP2_1
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21))
#elif NETCOREAPP3_0
                .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0")))
#elif NETCOREAPP5_0
                .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp5.0", null, ".NET Core 5.0")))
#else
#error Target frameworks need to be updated.
#endif
                .With(new GcMode {
                Server = true
            })
                .With(RunStrategy.Throughput));
        }
Beispiel #2
0
    public MultipleJitConfig()
    {
        var netCoreApp31 = new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1");

        var cli11_32 = NetCoreAppSettings.NetCoreApp11.WithCustomDotNetCliPath(Paths.DotNetCLIx86, "Default");
        var cli11_64 = NetCoreAppSettings.NetCoreApp11.WithCustomDotNetCliPath(Paths.DotNetCLIx64, "Default");
        var cli20_32 = NetCoreAppSettings.NetCoreApp20.WithCustomDotNetCliPath(Paths.DotNetCLIx86, "Default");
        var cli20_64 = NetCoreAppSettings.NetCoreApp20.WithCustomDotNetCliPath(Paths.DotNetCLIx64, "Default");
        var cli21_32 = NetCoreAppSettings.NetCoreApp21.WithCustomDotNetCliPath(Paths.DotNetCLIx86, "Default");
        var cli21_64 = NetCoreAppSettings.NetCoreApp21.WithCustomDotNetCliPath(Paths.DotNetCLIx64, "Default");
        var cli31_32 = netCoreApp31.WithCustomDotNetCliPath(Paths.DotNetCLIx86, "Default");
        var cli31_64 = netCoreApp31.WithCustomDotNetCliPath(Paths.DotNetCLIx64, "Default");

        Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(cli11_64)).AsBaseline().WithId("netcoreapp1.1"));
        Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(cli11_32)).AsBaseline().WithId("netcoreapp1.1"));
        Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(cli20_64)).WithId("netcoreapp2.0"));
        Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(cli20_32)).WithId("netcoreapp2.0"));
        Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(cli21_64)).WithId("netcoreapp2.1"));
        Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(cli21_32)).WithId("netcoreapp2.1"));
        Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(cli31_64)).WithId("netcoreapp3.1"));
        Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(cli31_32)).WithId("netcoreapp3.1"));

        Add(DefaultConfig.Instance.GetLoggers().ToArray());
        Add(DefaultConfig.Instance.GetColumnProviders().ToArray());
        Add(DefaultConfig.Instance.GetExporters().ToArray());
        Set(ByMethodByPlatformOrderProvider.Instance);
        ArtifactsPath = @"..\..\out\bdn\JitRegression";
    }
        public Use32BitCli()
        {
            // .NET
            //			if (Environment.Is64BitOperatingSystem)
            //			{
            //				Add(Job.RyuJitX64.With(CsProjClassicNetToolchain.Net47).WithId(".NET 4.7 x86_64"));
            //			}
            //			Add(Job.LegacyJitX86.With(CsProjClassicNetToolchain.Net47).WithId(".NET 4.7 x86"));

            // .NET Core
            if (Environment.Is64BitOperatingSystem)
            {
                //				var dotnetCli = NetCoreAppSettings
                //					.NetCoreApp30
                //					.WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe", "64 bit cli");
                //				Add(Job.Core.With(Platform.X64).With(CsProjCoreToolchain.From(dotnetCli)).WithId("64 bit cli"));

                var dotnetCli32bit = NetCoreAppSettings
                                     .NetCoreApp30
                                     .WithCustomDotNetCliPath(@"C:\Program Files (x86)\dotnet\dotnet.exe", "32 bit cli");
                AddJob(Job.Default.WithRuntime(CoreRuntime.Core30)
                       .WithToolchain(CsProjCoreToolchain.From(dotnetCli32bit)).WithId("32 bit cli"));
            }
            else
            {
                AddJob(Job.Default.WithToolchain(CsProjCoreToolchain.NetCoreApp30));
            }

            AddLogger(new ConsoleLogger());
            AddExporter(DefaultExporters.Plain);
            AddColumnProvider(DefaultColumnProviders.Instance);
        }
Beispiel #4
0
        public DefaultCoreConfig()
        {
            Add(MarkdownExporter.GitHub);

            Add(MemoryDiagnoser.Default);
            Add(StatisticColumn.OperationsPerSecond);
            Add(DefaultColumnProviders.Job);
            Add(DefaultColumnProviders.Instance);
            Add(DefaultColumnProviders.Params);
            Add(DefaultColumnProviders.Diagnosers);

            Add(StatisticColumn.Mean);
            Add(StatisticColumn.Median);

            Add(StatisticColumn.StdErr);

            Add(BaselineScaledColumn.Scaled);

            Add(ConsoleLogger.Default);


            Add(JitOptimizationsValidator.FailOnError);

            Add(Job.Core
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21))
                .With(new GcMode {
                Server = true
            })
                .With(RunStrategy.Throughput));
        }
Beispiel #5
0
        public CustomPathsBenchmarkConfig(string dotnetCliPath, string monoPath)
        {
            Add(Job.Default.With(Runtime.Core).With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp2.0", null, "2.0", dotnetCliPath))).AsBaseline().WithId("2.0"));
            Add(Job.Default.With(Runtime.Core).With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp2.1", null, "2.1", dotnetCliPath))).WithId("2.1"));

#if NET46
            if (Type.GetType("Mono.Runtime") == null) // not a Mono
            {
                Add(Job.Default.With(Runtime.Clr).WithId("4.x"));
            }
#endif

            Add(Job.Default.With(new MonoRuntime("Mono", monoPath)).WithId("Mono"));

            Add(MemoryDiagnoser.Default);

            Add(DefaultConfig.Instance.GetValidators().ToArray());
            Add(DefaultConfig.Instance.GetLoggers().ToArray());
            Add(DefaultConfig.Instance.GetColumnProviders().ToArray());

            Add(new CsvMeasurementsExporter(CsvSeparator.Semicolon));
            Add(MarkdownExporter.GitHub);
            Add(HtmlExporter.Default);
            Add(StatisticColumn.AllStatistics);

            Set(new BenchmarkDotNet.Reports.SummaryStyle
            {
                PrintUnitsInHeader  = true,
                PrintUnitsInContent = false,
                TimeUnit            = BenchmarkDotNet.Horology.TimeUnit.Microsecond,
                SizeUnit            = BenchmarkDotNet.Columns.SizeUnit.B
            });
        }
        public DefaultCoreConfig()
        {
            AddLogger(ConsoleLogger.Default);
            AddExporter(MarkdownExporter.GitHub);

            AddDiagnoser(MemoryDiagnoser.Default);
            AddColumn(StatisticColumn.OperationsPerSecond);
            AddColumnProvider(DefaultColumnProviders.Instance);

            AddValidator(JitOptimizationsValidator.FailOnError);

            // So that the using statement, above, doesn't appear as a warning for being unused
            _ = NetCoreAppSettings.NetCoreApp20;

            AddJob(Job.Default
#if NETCOREAPP2_1
                   .WithToolchain(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21))
#elif NETCOREAPP3_0
                   .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0")))
#elif NETCOREAPP3_1
                   .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1")))
#elif NET5_0
                   .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings("net5.0", null, ".NET Core 5.0")))
#elif NET6_0
                   .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings("net6.0", null, ".NET 6.0")))
#elif NET472
                   .WithToolchain(CsProjClassicNetToolchain.Net472)
#else
#error Target frameworks need to be updated.
#endif
                   .WithGcMode(new GcMode {
                Server = true
            })
                   .WithStrategy(RunStrategy.Throughput));
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            List <Type> benchmarks = GetBenchmarkTypesFromArgs(args);

            // Set the argument as the crash dump.  We can't just set CrashDump here because it needs to be read from child processes.
            if (args.Length > 0)
            {
                Environment.SetEnvironmentVariable(DumpFileEnv, args[0]);
            }

            // We want to run this even if we don't use the result to make sure we can successfully load 'CrashDump'.
            int targetPointerSize = GetTargetPointerSize();


            ManualConfig benchmarkConfiguration = ManualConfig.Create(DefaultConfig.Instance);

            // Windows supports x86 and x64 so we need to choose the correct version of .Net.
            Job job;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                string dotnetPath = GetDotnetPath(targetPointerSize);

                if (targetPointerSize == 4)
                {
                    job = Job.RyuJitX86.With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp31.WithCustomDotNetCliPath(dotnetPath)));
                }
                else
                {
                    job = Job.RyuJitX64.With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp31.WithCustomDotNetCliPath(dotnetPath)));
                }
            }
            else
            {
                job = Job.Default;
            }

            string id = $"{RuntimeInformation.OSDescription} {RuntimeInformation.FrameworkDescription} {(targetPointerSize == 4 ? "32bit" : "64bit")}";

            job = job.WithId(id)
                  .WithWarmupCount(1)
                  .WithIterationTime(TimeInterval.FromSeconds(1))
                  .WithMinIterationCount(5)
                  .WithMaxIterationCount(10)
                  .DontEnforcePowerPlan();       // make sure BDN does not try to enforce High Performance power plan on Windows

            benchmarkConfiguration.Add(job);

            if (benchmarks.Count == 0)
            {
                BenchmarkRunner.Run(Assembly.GetCallingAssembly(), benchmarkConfiguration);
            }
            else
            {
                foreach (Type t in benchmarks)
                {
                    BenchmarkRunner.Run(t, benchmarkConfiguration);
                }
            }
        }
Beispiel #8
0
        public void CustomTargetPlatformJobsAreGroupedByTargetFrameworkMoniker()
        {
            var net5Config = ManualConfig.Create(DefaultConfig.Instance)
                             .AddJob(Job.Default.WithToolchain(CsProjCoreToolchain.NetCoreApp50));
            var net5WindowsConfig1 = ManualConfig.Create(DefaultConfig.Instance)
                                     .AddJob(Job.Default.WithToolchain(CsProjCoreToolchain.From(new Toolchains.DotNetCli.NetCoreAppSettings(
                                                                                                    targetFrameworkMoniker: "net5.0-windows",
                                                                                                    runtimeFrameworkVersion: null,
                                                                                                    name: ".NET 5.0"))));
            // a different INSTANCE of CsProjCoreToolchain that also targets "net5.0-windows"
            var net5WindowsConfig2 = ManualConfig.Create(DefaultConfig.Instance)
                                     .AddJob(Job.Default.WithToolchain(CsProjCoreToolchain.From(new Toolchains.DotNetCli.NetCoreAppSettings(
                                                                                                    targetFrameworkMoniker: "net5.0-windows",
                                                                                                    runtimeFrameworkVersion: null,
                                                                                                    name: ".NET 5.0"))));

            var benchmarksNet5         = BenchmarkConverter.TypeToBenchmarks(typeof(Plain1), net5Config);
            var benchmarksNet5Windows1 = BenchmarkConverter.TypeToBenchmarks(typeof(Plain2), net5WindowsConfig1);
            var benchmarksNet5Windows2 = BenchmarkConverter.TypeToBenchmarks(typeof(Plain3), net5WindowsConfig2);

            var grouped = benchmarksNet5.BenchmarksCases
                          .Union(benchmarksNet5Windows1.BenchmarksCases)
                          .Union(benchmarksNet5Windows2.BenchmarksCases)
                          .GroupBy(benchmark => benchmark, new BenchmarkPartitioner.BenchmarkRuntimePropertiesComparer())
                          .ToArray();

            Assert.Equal(2, grouped.Length);

            Assert.Single(grouped, group => group.Count() == 3); // Plain1 (3 methods) runing against "net5.0"
            Assert.Single(grouped, group => group.Count() == 6); // Plain2 (3 methods) and Plain3 (3 methods) runing against "net5.0-windows"
        }
Beispiel #9
0
        public BenchmarkConfig()
        {
            Add(Job.Default.With(Runtime.Core).With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp20)).AsBaseline().WithId("2.0"));
            Add(Job.Default.With(Runtime.Core).With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21)).WithId("2.1"));

#if NET46
            if (Type.GetType("Mono.Runtime") == null) // not a Mono
            {
                Add(Job.Default.With(Runtime.Clr).WithId("4.x"));
            }
#endif
            Add(Job.Default.With(Runtime.Mono).WithId("Mono"));

            Add(MemoryDiagnoser.Default);

            Add(DefaultConfig.Instance.GetValidators().ToArray());
            Add(DefaultConfig.Instance.GetLoggers().ToArray());
            Add(DefaultConfig.Instance.GetColumnProviders().ToArray());

            Add(new CsvMeasurementsExporter(CsvSeparator.Semicolon));
            //Add(RPlotExporter.Default); // it produces nice plots but requires R to be installed
            Add(MarkdownExporter.GitHub);
            Add(HtmlExporter.Default);
            //Add(StatisticColumn.AllStatistics);

            Set(new BenchmarkDotNet.Reports.SummaryStyle
            {
                PrintUnitsInHeader  = true,
                PrintUnitsInContent = false,
                TimeUnit            = BenchmarkDotNet.Horology.TimeUnit.Microsecond,
                SizeUnit            = BenchmarkDotNet.Columns.SizeUnit.B
            });
        }
Beispiel #10
0
 public ConfigWithCustomEnvVars()
 {
     Add(Job.Core
         .With(new[] { new EnvironmentVariable(JitNoInline, "0") })
         .WithWarmupCount(3)
         .WithTargetCount(5)
         .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp30)));
 }
Beispiel #11
0
 public Config()
 {
     Add(Job.Default.With(CsProjCoreToolchain.From(
                              new NetCoreAppSettings(
                                  targetFrameworkMoniker: "netcoreapp2.2",
                                  runtimeFrameworkVersion: "2.2.0",
                                  name: ".NET Core 2.2.0"))));
 }
        public static void Main(string[] args)
        {
            var config = DefaultConfig.Instance
                         //.With(Job.Default.With(CsProjClassicNetToolchain.Net472))
                         .With(Job.Default.With(CsProjCoreToolchain.NetCoreApp31))
                         .With(Job.Default.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp5.0", null, ".NET Core 5.0"))))
            ;

            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
        }
Beispiel #13
0
        /// <summary>
        /// we need our own toolchain because MSBuild by default does not copy recursive native dependencies to the output
        /// </summary>
        private IToolchain CreateToolchain()
        {
            var tfm    = GetTargetFrameworkMoniker();
            var csProj = CsProjCoreToolchain.From(new NetCoreAppSettings(targetFrameworkMoniker: tfm, runtimeFrameworkVersion: null, name: tfm));

            return(new Toolchain(
                       tfm,
                       new ProjectGenerator(tfm), // custom generator that copies native dependencies
                       csProj.Builder,
                       csProj.Executor));
        }
        private static IConfig GetConfig()
        {
#if DEBUG
            return(new DebugInProcessConfig());
#else
            return(ManualConfig.CreateEmpty()
                   .AddJob(Job.Default
                           .WithToolchain(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp60))
                           .AsDefault()));
#endif
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            var dotnetCli32 = NetCoreAppSettings.NetCoreApp50.WithCustomDotNetCliPath(@"C:\Program Files (x86)\dotnet\dotnet.exe", "32 bit cli");
            var dotnetCli64 = NetCoreAppSettings.NetCoreApp50.WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe", "64 bit cli");

            var job32 = Job.Default.WithPlatform(Platform.X86).WithToolchain(CsProjCoreToolchain.From(dotnetCli32));
            var job64 = Job.Default.WithPlatform(Platform.X64).WithToolchain(CsProjCoreToolchain.From(dotnetCli64));

            BenchmarkRunner.Run <HookBenchmark <NativeCalculator86> >(ManualConfig.Create(DefaultConfig.Instance).AddJob(job32));
            BenchmarkRunner.Run <HookBenchmark <NativeCalculator64> >(ManualConfig.Create(DefaultConfig.Instance).AddJob(job64));
        }
Beispiel #16
0
 public MinimalConfiguration()
 {
     AddColumnProvider(DefaultColumnProviders.Instance);
     AddJob(Job.Default
            .WithToolchain(CsProjCoreToolchain.From(NetCoreAppSettings
                                                    .NetCoreApp60
                                                    .WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe")))
            .WithPowerPlan(PowerPlan.HighPerformance)
            .WithPlatform(Platform.X64));
     AddLogger(new SummaryFirstLogger());
 }
Beispiel #17
0
            public CustomPathsConfig()
            {
                var netcoreapp31x64 = NetCoreAppSettings
                                      .NetCoreApp31
                                      .WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe", ".NET Core x64");

                Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(netcoreapp31x64)).WithId(".NET Core x64"));

                Add(Job.LegacyJitX86.With(CsProjClassicNetToolchain.Net48));
                Add(Job.RyuJitX64.With(CsProjClassicNetToolchain.Net48));
            }
Beispiel #18
0
        public Config()
        {
            // Disable this policy because our benchmarks refer
            // to a non-optimized SkiaSharp that we do not own.
            Options |= ConfigOptions.DisableOptimizationsValidator;

            Add(Job.Default.With(CsProjCoreToolchain.From(
                                     new NetCoreAppSettings(
                                         targetFrameworkMoniker: "netcoreapp2.2",
                                         runtimeFrameworkVersion: "2.2.0",
                                         name: ".NET Core 2.2.0"))));
        }
 public ConfigBase()
 {
     Add(DefaultConfig.Instance);
     Add(MarkdownExporter.Console);
     Add(Job.Mono);
     Add(Job.Default.With(Runtime.Core)
         .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp11))
         .WithId(".NET Core 1.1"));
     Add(Job.Default.With(Runtime.Core)
         .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21))
         .WithId(".NET Core 2.1"));
 }
Beispiel #20
0
            public CustomPathsConfig()
            {
                var dotnetCli32bit = NetCoreAppSettings
                                     .NetCoreApp20
                                     .WithCustomDotNetCliPath(@"C:\Program Files (x86)\dotnet\dotnet.exe", "32 bit cli");

                var dotnetCli64bit = NetCoreAppSettings
                                     .NetCoreApp20
                                     .WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe", "64 bit cli");

                Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(dotnetCli32bit)).WithId("32 bit cli"));
                Add(Job.RyuJitX64.With(CsProjCoreToolchain.From(dotnetCli64bit)).WithId("64 bit cli"));
            }
Beispiel #21
0
        public SgenConfig()
        {
            Add(Job.Dry.With(RunStrategy.ColdStart).WithLaunchCount(10) // Dry job is 1 execution without pre-Jitting
                .WithCustomBuildConfiguration("SGEN")                   // this is going to use Microsoft.XmlSerializer.Generator
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21)).WithId("SGEN"));

            Add(Job.Dry.With(RunStrategy.ColdStart).WithLaunchCount(10) // Dry job is 1 execution without pre-Jitting
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21)).WithId("NO_SGEN"));

            // to make sure that Benchmarks.XmlSerializers.dll file exists (https://github.com/dotnet/core/blob/master/samples/xmlserializergenerator-instructions.md)
            // you can uncomment the line below
            KeepBenchmarkFiles = true;
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            var config = DefaultConfig.Instance
                         .AddJob(
                Job.Default.WithToolchain(
                    CsProjCoreToolchain.From(
                        new NetCoreAppSettings(
                            targetFrameworkMoniker: "net5.0-windows",      // the key to make it work
                            runtimeFrameworkVersion: null,
                            name: "5.0")))
                .AsDefault());

            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
        }
Beispiel #23
0
        public MyConfig()
        {
            Add(Job.Default.With(
                    CsProjCoreToolchain.From(
                        new NetCoreAppSettings(
                            targetFrameworkMoniker: "netcoreapp2.1",
                            runtimeFrameworkVersion: "2.1.0-preview2-26130-06",
                            name: ".NET Core 2.1"))));

            Add(DefaultColumnProviders.Instance);
            Add(MarkdownExporter.GitHub);
            Add(MemoryDiagnoser.Default);
            Add(new ConsoleLogger());
            Add(new HtmlExporter());
        }
Beispiel #24
0
            public ConfigWithCustomEnvVars()
            {
                Add(Job.Core
                    .With(new[] { new EnvironmentVariable(JitNoInline, "1") })
//                    .WithTargetCount(48)
//                    .WithUnrollFactor(16)
                    .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp30))
                    .WithId("TC Enabled"));

                Add(Job.Core
                    .With(new[] { new EnvironmentVariable(JitNoInline, "1") })
//                    .WithTargetCount(48)
//                    .WithUnrollFactor(16)
                    .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp30))
                    .WithId("TC Disabled"));
            }
Beispiel #25
0
        private static IConfig GetConfig()
        {
#if DEBUG
            // So that the using statements, above, don't appear as a warning for being unused
            _ = Job.Default;
            _ = CsProjCoreToolchain.NetCoreApp30;
            _ = NetCoreAppSettings.NetCoreApp30;

            return(new DebugInProcessConfig());
#else
            return(ManualConfig.CreateEmpty()
                   .AddJob(Job.Default
                           .WithToolchain(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp60))
                           .AsDefault()));
#endif
        }
        public DefaultCoreConfig()
        {
            Add(ConsoleLogger.Default);
            Add(MarkdownExporter.GitHub);

            Add(MemoryDiagnoser.Default);
            Add(StatisticColumn.OperationsPerSecond);
            Add(DefaultColumnProviders.Instance);

            Add(JitOptimizationsValidator.FailOnError);

            // TODO(JamesNK): Change to out of process and enable server GC when https://github.com/dotnet/BenchmarkDotNet/issues/1023 is fixed
            Add(Job.Core
                .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0")))
                .With(InProcessToolchain.Instance)
                .With(RunStrategy.Throughput));
        }
        public DefaultCoreConfig()
        {
            AddLogger(ConsoleLogger.Default);
            AddExporter(MarkdownExporter.GitHub);

            AddDiagnoser(MemoryDiagnoser.Default);
            AddColumn(StatisticColumn.OperationsPerSecond);
            AddColumnProvider(DefaultColumnProviders.Instance);

            AddValidator(JitOptimizationsValidator.FailOnError);

            AddJob(Job.Default
                   .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1")))
                   .WithGcMode(new GcMode {
                Server = true
            })
                   .WithStrategy(RunStrategy.Throughput));
        }
        internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null, bool preferMsBuildToolchains = false)
        {
            switch (runtime)
            {
            case ClrRuntime clrRuntime:
                if (RuntimeInformation.IsNetCore || preferMsBuildToolchains)
                {
                    return(clrRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(clrRuntime.RuntimeMoniker)
                            : CsProjClassicNetToolchain.From(clrRuntime.MsBuildMoniker));
                }

                return(RoslynToolchain.Instance);

            case MonoRuntime mono:
                if (!string.IsNullOrEmpty(mono.AotArgs))
                {
                    return(MonoAotToolchain.Instance);
                }

                return(RoslynToolchain.Instance);

            case CoreRuntime coreRuntime:
                if (descriptor != null && descriptor.Type.Assembly.IsLinqPad())
                {
                    return(InProcessEmitToolchain.Instance);
                }
                if (coreRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized)
                {
                    return(GetToolchain(coreRuntime.RuntimeMoniker));
                }

                return(CsProjCoreToolchain.From(new DotNetCli.NetCoreAppSettings(coreRuntime.MsBuildMoniker, null, coreRuntime.Name)));

            case CoreRtRuntime coreRtRuntime:
                return(coreRtRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(coreRtRuntime.RuntimeMoniker)
                            : CoreRtToolchain.CreateBuilder().UseCoreRtNuGet().TargetFrameworkMoniker(coreRtRuntime.MsBuildMoniker).ToToolchain());

            default:
                throw new ArgumentOutOfRangeException(nameof(runtime), runtime, "Runtime not supported");
            }
        }
Beispiel #29
0
        public CoreConfig()
        {
            Add(JitOptimizationsValidator.FailOnError);
            Add(StatisticColumn.OperationsPerSecond);
            Add(MemoryDiagnoser.Default);

            Add(Job.Default
                .With(BenchmarkDotNet.Environments.Runtime.Core)
                .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp2.1", null, ".NET Core 2.1")))
                .WithRemoveOutliers(false)
                .With(new GcMode()
            {
                Server = true
            })
                .With(RunStrategy.Throughput)
                .WithLaunchCount(3)
                .WithWarmupCount(5)
                .WithTargetCount(10));
        }
Beispiel #30
0
        public CoreConfig()
        {
            Add(ConsoleLogger.Default);

            Add(JitOptimizationsValidator.FailOnError);

            Add(MemoryDiagnoser.Default);
            Add(StatisticColumn.OperationsPerSecond);

#if DESKTOPCLR
            Add(Job.Clr
                .With(BenchmarkDotNet.Environments.Runtime.Clr)
                .With(BenchmarkDotNet.Environments.Platform.X64)
                .WithRemoveOutliers(false)
                .With(new GcMode {
                Server = true
            })
                .With(RunStrategy.Throughput)
                .WithLaunchCount(3)
                .WithWarmupCount(5)
                .WithTargetCount(10));
#else
            Add(Job.Core
#if NETCOREAPP2_0
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp20))
#elif NETCOREAPP2_1
                .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21))
#endif
                .With(BenchmarkDotNet.Environments.Runtime.Core)
                .With(BenchmarkDotNet.Environments.Platform.X64)
                .WithRemoveOutliers(false)
                .With(new GcMode {
                Server = true
            })
                .With(RunStrategy.Throughput)
                .WithLaunchCount(3)
                .WithWarmupCount(5)
                .WithTargetCount(10));
#endif

            Add(JsonExporter.Full, MarkdownExporter.Default);//, HtmlExporter.Default);
        }