/// <summary> /// Runs the benchmark suite and returns the results. /// </summary> /// <returns>The results of the benchmark run</returns> public RunResult Run() { ThrowIfCancellationRequested(); RunResult result = new RunResult(); result.Settings = m_run.Settings; result.Environment = new RunEnvironment(); result.Environment.RunStartTime = DateTime.Now; result.Environment.FrameworkDescription = RuntimeInformation.FrameworkDescription; result.Environment.OperatingSystem = RuntimeInformation.OSDescription; result.Environment.OSArchitecture = RuntimeInformation.OSArchitecture.ToString(); Logger.LogAlways($"Running benchmarks with server GC: {m_run.Settings.ServerGC}"); Logger.LogAlways($"Running benchmarks with concurrent GC: {m_run.Settings.ConcurrentGC}"); foreach (var version in m_run.CoreClrVersions) { // these should have been validated already before runnning Debug.Assert(!string.IsNullOrEmpty(version.Path)); Debug.Assert(!string.IsNullOrEmpty(version.Name)); Debug.Assert(Directory.Exists(version.Path)); Debug.Assert(m_versionMap.ContainsKey(version)); PreparedCoreClrVersion preparedVersion = m_versionMap[version]; CoreclrVersionRunResult versionResult = RunVersion(preparedVersion); result.PerVersionResults.Add(Tuple.Create(version, versionResult)); } ThrowIfCancellationRequested(); return(result); }
/// <summary> /// Runs the benchmark suite on a single version of CoreCLR and /// returns the results. /// </summary> /// <param name="coreRootPath">The path to CORE_ROOT for the version /// of CoreCLR being tested.</param> /// <returns>The results of this run</returns> private CoreclrVersionRunResult RunVersion(PreparedCoreClrVersion version) { ThrowIfCancellationRequested(); Logger.LogAlways($"Beginning run of version \"{version.Name}\""); CoreclrVersionRunResult result = new CoreclrVersionRunResult(); Debug.Assert(Directory.GetCurrentDirectory() == m_options.OutputDirectory); // TODO(segilles) error handling here. We should avoid propegating exceptions // as best we can. string folderName = Path.Combine(Directory.GetCurrentDirectory(), version.Name); Directory.CreateDirectory(folderName); Directory.SetCurrentDirectory(folderName); m_relativePath.Push(version.Name); try { foreach (var benchmark in m_run.Suite) { Debug.Assert(benchmark != null); BenchmarkResult benchResult = RunBenchmark(version, benchmark); result.BenchmarkResults.Add(benchResult); } // write out the version description File.WriteAllText( Path.Combine(folderName, Constants.VersionJsonName), JsonConvert.SerializeObject(version)); ThrowIfCancellationRequested(); return(result); } finally { string upOneDir = Path.Combine(Directory.GetCurrentDirectory(), ".."); Directory.SetCurrentDirectory(upOneDir); m_relativePath.Pop(); } }