Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix custom parsing and defaults
  • Loading branch information
am11 committed Nov 9, 2022
commit 32c3deb166cc28392c9c1717716caab40431fe04
4 changes: 2 additions & 2 deletions src/cijobs/CIJobsRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ internal sealed class CIJobsRootCommand : RootCommand
public Option<string> JobName { get; } =
new(new[] { "--job", "-j" }, "Name of the job.");
public Option<string> BranchName { get; } =
new(new[] { "--branch", "-b" }, _ => "master", true, "Name of the branch.");
new(new[] { "--branch", "-b" }, () => "master", "Name of the branch.");
public Option<string> RepoName { get; } =
new(new[] { "--repo", "-r" }, _ => "dotnet_coreclr", true, "Name of the repo (e.g. dotnet_corefx or dotnet_coreclr).");
new(new[] { "--repo", "-r" }, () => "dotnet_coreclr", "Name of the repo (e.g. dotnet_corefx or dotnet_coreclr).");
public Option<string> MatchPattern { get; } =
new(new[] { "--match", "-m" }, "Regex pattern used to select jobs output.");
public Option<int> JobNumber { get; } =
Expand Down
25 changes: 20 additions & 5 deletions src/jit-analyze/JitAnalyzeRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.Globalization;

namespace ManagedCodeGen
{
Expand All @@ -17,13 +18,13 @@ internal sealed class JitAnalyzeRootCommand : RootCommand
public Option<bool> Recursive { get; } =
new(new[] { "--recursive", "-r" }, "Search directories recursively");
public Option<string> FileExtension { get; } =
new("--file-extension", _ => ".dasm", true, "File extension to look for");
new("--file-extension", () => ".dasm", "File extension to look for");
public Option<int> Count { get; } =
new(new[] { "--count", "-c" }, _ => 20, true, "Count of files and methods (at most) to output in the summary. (count) improvements and (count) regressions of each will be included");
new(new[] { "--count", "-c" }, () => 20, "Count of files and methods (at most) to output in the summary. (count) improvements and (count) regressions of each will be included");
public Option<bool> Warn { get; } =
new(new[] { "--warn", "-w" }, "Generate warning output for files/methods that only exists in one dataset or the other (only in base or only in diff)");
public Option<List<string>> Metrics { get; } =
new(new[] { "--metrics", "-m" }, _ => new List<string> { "CodeSize" }, true, $"Comma-separated metric to use for diff computations. Available metrics: {MetricCollection.ListMetrics()}");
new(new[] { "--metrics", "-m" }, () => new List<string> { "CodeSize" }, $"Metrics to use for diff computations. Available metrics: {MetricCollection.ListMetrics()}");
public Option<string> Note { get; } =
new("--note", "Descriptive note to add to summary output");
public Option<bool> NoReconcile { get; } =
Expand All @@ -41,9 +42,23 @@ internal sealed class JitAnalyzeRootCommand : RootCommand
public Option<bool> RetainOnlyTopFiles { get; } =
new("--retain-only-top-files", "Retain only the top 'count' improvements/regressions .dasm files. Delete other files. Useful in CI scenario to reduce the upload size");
public Option<double> OverrideTotalBaseMetric { get; } =
new("--override-total-base-metric", "Override the total base metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known");
new("--override-total-base-metric", result =>
{
if (double.TryParse(result.Tokens[0].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var val))
return val;

result.ErrorMessage = $"Cannot parse argument '{result.Tokens[0].Value}' for option '--override-total-base-metric' as expected type 'System.Double'.";
return 0;
}, false, "Override the total base metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known");
public Option<double> OverrideTotalDiffMetric { get; } =
new("--override-total-diff-metric", "Override the total diff metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known");
new("--override-total-diff-metric", result =>
{
if (double.TryParse(result.Tokens[0].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var val))
return val;

result.ErrorMessage = $"Cannot parse argument '{result.Tokens[0].Value}' for option '--override-total-diff-metric' as expected type 'System.Double'.";
return 0;
}, false, "Override the total diff metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known");
public Option<bool> IsDiffsOnly { get; } =
new("--is-diffs-only", "Specify that the disassembly files are only produced for contexts with diffs, so avoid producing output making assumptions about the number of contexts");
public Option<bool> IsSubsetOfDiffs { get; } =
Expand Down