public static int Main(string[] args) { bool shouldReportBenchview = false; bool shouldUploadTrace = true; bool isCiTest = false; string submissionName = null; string submissionType = null; string traceDestination = @"\\mlangfs1\public\basoundr\PerfTraces"; string branch = null; string searchDirectory = AppDomain.CurrentDomain.BaseDirectory; var parameterOptions = new OptionSet() { { "report-benchview", "report the performance results to benchview.", _ => shouldReportBenchview = true }, { "benchview-submission-type=", $"submission type to use when uploading to benchview ({String.Join(",", Benchview.ValidSubmissionTypes)})", type => { submissionType = type; } }, { "benchview-submission-name=", "submission name to use when uploading to benchview (required for private and local submissions)", name => { submissionName = name; } }, { "branch=", "name of the branch you are measuring on", name => { branch = name; } }, { "ci-test", "mention that we are running in the continuous integration lab", _ => isCiTest = true }, { "no-trace-upload", "disable the uploading of traces", _ => shouldUploadTrace = false }, { "trace-upload_destination=", "set the trace uploading destination", loc => { traceDestination = loc; } }, { "search-directory=", "the directory to recursively search for tests", dir => { searchDirectory = dir; } } }; parameterOptions.Parse(args); if (shouldReportBenchview) { if (!CheckBenchViewOptions(submissionType, submissionName) || !Benchview.CheckEnvironment() || !DetermineBranch(ref branch)) { return(-1); } Benchview.SetConfiguration(submissionType, branch); } Cleanup(); AsyncMain(isCiTest, searchDirectory).GetAwaiter().GetResult(); if (isCiTest) { Log("Running under continuous integration"); } if (shouldReportBenchview) { Log("Uploading results to benchview"); Benchview.UploadBenchviewReport(submissionName); } if (shouldUploadTrace) { Log("Uploading traces"); UploadTraces(GetCPCDirectoryPath(), traceDestination); } return(0); }
private static bool CheckBenchViewOptions(string submissionType, string submissionName) { if (String.IsNullOrWhiteSpace(submissionType)) { Log("Parameter --benchview-submission-type is required when --report-benchview is specified"); return(false); } if (!Benchview.IsValidSubmissionType(submissionType)) { Log($"Parameter --benchview-submission-type must be one of ({String.Join(",", Benchview.ValidSubmissionTypes)})"); return(false); } if (String.IsNullOrWhiteSpace(submissionName) && submissionType != "rolling") { Log("Parameter --benchview-submission-name is required for \"private\" and \"local\" submissions"); return(false); } return(true); }