コード例 #1
0
        private ProcessStartInfo CreateStartInfo(Benchmark benchmark, string exeName, string args, string workingDirectory)
        {
            var start = new ProcessStartInfo
            {
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                CreateNoWindow         = true,
                WorkingDirectory       = workingDirectory
            };
            var runtime = benchmark.Job.Runtime == Runtime.Host ? RuntimeInformation.GetCurrent() : benchmark.Job.Runtime;

            switch (runtime)
            {
            case Runtime.Clr:
            case Runtime.Dnx:
            case Runtime.Core:
                start.FileName  = exeName;
                start.Arguments = args;
                break;

            case Runtime.Mono:
                start.FileName  = "mono";
                start.Arguments = exeName + " " + args;
                break;

            default:
                throw new NotSupportedException("Runtime = " + benchmark.Job.Runtime);
            }
            return(start);
        }
コード例 #2
0
        public virtual bool IsSupported(Benchmark benchmark, ILogger logger)
        {
            var runtime = benchmark.Job.Runtime == Runtime.Host ? RuntimeInformation.GetCurrent() : benchmark.Job.Runtime;

            if (runtime != Runtime.Mono && benchmark.Job.Jit == Jit.Llvm)
            {
                logger.WriteLineError($"Llvm is supported only for Mono, benchmark {benchmark.ShortInfo} will not be executed");
                return(false);
            }

            return(true);
        }
コード例 #3
0
        internal static IToolchain GetToolchain(this Runtime runtime)
        {
            switch (runtime)
            {
            case Runtime.Host:
                return(GetToolchain(RuntimeInformation.GetCurrent()));

            case Runtime.Clr:
            case Runtime.Mono:
                return(Classic.ClassicToolchain.Instance);

            case Runtime.Core:
                return(Core.CoreToolchain.Instance);
            }

            throw new NotSupportedException("Runtime not supported");
        }
コード例 #4
0
ファイル: Toolchain.cs プロジェクト: tanzhur/BenchmarkDotNet
        public static IToolchain GetToolchain(Runtime runtime)
        {
            switch (runtime)
            {
            case Runtime.Host:
                return(GetToolchain(RuntimeInformation.GetCurrent()));

            case Runtime.Clr:
            case Runtime.Mono:
#if CLASSIC
                return(Classic.ClassicToolchain.Instance);
#endif
            case Runtime.Dnx:
                return(Dnx.DnxToolchain.Instance);

            case Runtime.Core:
                return(Core.CoreToolchain.Instance);
            }

            throw new NotSupportedException("Runtime not supported");
        }
コード例 #5
0
 public static Runtime GetCurrentRuntime() => RuntimeInformation.GetCurrent();