Пример #1
0
        private string BuildAllRuntimes()
        {
            var jobRuntimes = new Dictionary <string, string>(); // JobId -> Runtime
            var orderedJobs = new List <string>();

            orderedJobs.Add("[Host]");
            jobRuntimes["[Host]"] = HostEnvironmentInfo.GetRuntimeInfo();

            foreach (var benchmarkReport in Reports)
            {
                string runtime = benchmarkReport.GetRuntimeInfo();
                if (runtime != null)
                {
                    string jobId = benchmarkReport.Benchmark.Job.ResolvedId;

                    if (!jobRuntimes.ContainsKey(jobId))
                    {
                        orderedJobs.Add(jobId);
                        jobRuntimes[jobId] = runtime;
                    }
                }
            }

            int jobIdMaxWidth = orderedJobs.Max(j => j.ToString().Length);

            var lines = orderedJobs.Select(jobId => $"  {jobId.PadRight(jobIdMaxWidth)} : {jobRuntimes[jobId]}");

            return(string.Join(Environment.NewLine, lines));
        }