Пример #1
0
        static void Main(string[] args)
        {
            var run = Job.MediumRun;
            // var run = Job.ShortRun;
            Job jobCore21 = run.With(Jit.RyuJit).With(CoreRuntime.Core21).WithId($"Core 2.1");
            Job jobCore31 = run.With(Jit.RyuJit).With(CoreRuntime.Core31).WithId($"Core 3.1");
            Job jobCore50 = run.With(Jit.RyuJit).With(CoreRuntime.Core50).WithId($"Core 5.0");

            IConfig config = ManualConfig.Create(DefaultConfig.Instance);

            config = config.With(new[] { jobCore21, jobCore31, jobCore50 });

            MonoRuntime monoRuntime = MonoRuntime.Default;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                config = config.With(run.With(ClrRuntime.Net48).WithId("FW 4.8"));
            }
            else
            {
                config = config.With(new[] { run.With(Jit.Llvm).With(monoRuntime).WithId("Mono+LLVM") });
                config = config.With(new[] { run.With(monoRuntime).WithId("Mono legacy") });
            }

            config = config.With(JsonExporter.Custom(fileNameSuffix: "-full", indentJson: true, excludeMeasurements: false));
            config = config.With(JsonExporter.Custom(fileNameSuffix: "-brief", indentJson: true, excludeMeasurements: true));
            config = config.With(MarkdownExporter.Default);
            config = config.With(HtmlExporter.Default);
            config = config.With(CsvExporter.Default);

            var summary = BenchmarkRunner.Run(typeof(Program).Assembly, config);
        }
        internal DisassemblyResult Disassemble(Benchmark benchmark, MonoRuntime mono)
        {
            Debug.Assert(mono == null || !RuntimeInformation.IsMono(), "Must never be called for Non-Mono benchmarks");

            var monoMethodName = GetMethodName(benchmark.Target);

            var output = ProcessHelper.RunAndReadOutputLineByLine(
                mono?.CustomPath ?? "mono",
                "-v -v -v -v "
                + $"--compile {monoMethodName} "
                + (benchmark.Job.Env.Jit == Jit.Llvm ? "--llvm" : "--nollvm")
                + $" \"{benchmark.Target.Type.GetTypeInfo().Assembly.Location}\"");

            return(OutputParser.Parse(output, monoMethodName, benchmark.Target.Method.Name));
        }
Пример #3
0
        internal DisassemblyResult Disassemble(Benchmark benchmark, MonoRuntime mono)
        {
            Debug.Assert(mono == null || !RuntimeInformation.IsMono, "Must never be called for Non-Mono benchmarks");

            var    benchmarkTarget = benchmark.Target;
            string fqnMethod       = GetMethodName(benchmarkTarget);
            string exePath         = benchmarkTarget.Type.GetTypeInfo().Assembly.Location;

            var environmentVariables = new Dictionary <string, string> {
                ["MONO_VERBOSE_METHOD"] = fqnMethod
            };
            string monoPath  = mono?.CustomPath ?? "mono";
            string arguments = $"--compile {fqnMethod} {exePath}";

            var    output      = ProcessHelper.RunAndReadOutputLineByLine(monoPath, arguments, environmentVariables, includeErros: true);
            string commandLine = $"{GetEnvironmentVariables(environmentVariables)} {monoPath} {arguments}";

            return(OutputParser.Parse(output, benchmarkTarget.Method.Name, commandLine));
        }
Пример #4
0
        void DownloadRepository(object state)
        {
            DownloadRepositoryParameters parameters = (DownloadRepositoryParameters)state;

            try
            {
                RepositorySpec repSpec = BuildRepSpec(
                    parameters.CloudRepository,
                    parameters.CloudOrganization);

                if (!ClientConfig.IsConfigured())
                {
                    AutoConfigClientConf.FromUnityAccessToken(
                        parameters.AccessToken,
                        repSpec,
                        parameters.ProjectPath);
                }

                if (WorkspaceExists(parameters.ProjectPath))
                {
                    // each domain reload, the package is reloaded.
                    // way need to check if we already downloaded it
                    return;
                }

                if (MonoRuntime.IsRunningUnder35RuntimeOrOlder())
                {
                    Debug.LogWarning(
                        "Plastic SCM: Detected an unsupported Runtime Version. " +
                        "Download Cloud Projects feature is not available for this Runtime Version. " +
                        "Please upgrade your Unity installation to the last LTS version and try again.");
                    return;
                }

                mDisplayProgress = true;

                WorkspaceInfo wkInfo = CreateWorkspace(
                    repSpec,
                    parameters.ProjectPath);

                mLog.DebugFormat("Created workspace {0} on {1}",
                                 wkInfo.Name,
                                 wkInfo.ClientPath);

                Plastic.API.Update(
                    wkInfo.ClientPath,
                    UpdateFlags.None,
                    null,
                    mUpdateNotifier);
            }
            catch (Exception ex)
            {
                LogException(ex);

                UnityEngine.Debug.LogErrorFormat(
                    "Error downloading Cloud Project: {0}",
                    ex.Message);

                mOperationFailed = true;
            }
            finally
            {
                mOperationFinished = true;
            }
        }
Пример #5
0
 public PackageManager(Context context)
 {
     _context          = context;
     _monoRuntime      = new MonoRuntime();
     _supportLibraries = new List <SupportLibrary>();
 }