private CertificateOptions DefineCertificateCommand(ArgumentSyntax syntax) { var options = new CertificateOptions(); syntax.DefineCommand("cert", ref command, Command.Certificate, "Authorization"); syntax.DefineOption("n|name", ref options.Name, "Friendly name of the cert."); syntax.DefineOption("dn|distinguished-name", ref options.DistinguishedName, $"The distinguished name of the cert."); syntax.DefineOptionList("v|value", ref options.Values, $"The distinguished name of the cert."); syntax.DefineOption("value-path", ref options.ValuesFile, $"The subject alt names."); syntax.DefineOption("cer|export-cer", ref options.ExportCer, "Path to export PEM cer."); syntax.DefineOption("export-key", ref options.ExportKey, "Path to export PEM key."); syntax.DefineOption("pfx|export-pfx", ref options.ExportPfx, "Path to export pfx."); syntax.DefineOption("revoke", ref options.RevokeCer, "Revoke certificate."); syntax.DefineOption("pw|password", ref options.Password, "Password for the pfx."); syntax.DefineOption("full-chain-off", ref options.NoChain, "Skip full cert chain."); syntax.DefineOption("server", ref options.Server, s => new Uri(s), $"ACME Directory Resource URI. (default: {options.Server})"); syntax.DefineOption("p|path", ref options.Path, $"File path used to load/save the registration. (default: {options.Path})"); syntax.DefineOption("f|force", ref options.Force, $"Force"); return(options); }
public static void BindToCommandLine(this ICommand command, ArgumentSyntax syntax) { var commandSyntax = syntax.DefineCommand(command.Name); commandSyntax.Help = command.HelpText; command.DefineArguments(syntax); }
public static ArgumentCommand<string> DefineCommand( this ArgumentSyntax syntax, string name, string help = null) { var arg = syntax.DefineCommand(name); arg.Help = help; return arg; }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandServerSet); syntax.DefineUriParameter(ParamServer, help: Strings.HelpServer); return(cmd); }
public void ParseCommandLine(ArgumentSyntax syntax) { ArgumentCommand command = syntax.DefineCommand(GetCommandName(), this); command.Help = CommandHelp; DefineOptions(syntax); DefineParameters(syntax); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand("show", help: Strings.HelpCommandServerShow); syntax.DefineServerOption(); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandAccountSet); syntax .DefineServerOption() .DefineParameter(KeyParam, help: Strings.HelpKey); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandAzureDns); DefineAzureOptions(syntax) .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId) .DefineParameter(DomainParam, help: Strings.HelpDomain); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandOrderList); syntax .DefineServerOption() .DefineKeyOption(); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandOrderShow); syntax .DefineServerOption() .DefineKeyOption() .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandAccountUpdate); syntax .DefineServerOption() .DefineKeyOption() .DefineParameter(EmailParam, help: Strings.HelpEmail); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandCertificatePem); syntax .DefineServerOption() .DefineKeyOption() .DefineOption(OutOption, help: Strings.HelpCertificateOut) .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandAzureSet); syntax .DefineOption(AzureTenantIdOption, help: Strings.HelpAzureTenantId) .DefineOption(AzureClientIdOption, help: Strings.HelpAzureClientId) .DefineOption(AzureSecretOption, help: Strings.HelpAzureSecret) .DefineOption(AzureSubscriptionIdOption, help: Strings.HelpAzureSubscriptionId); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandOrderValidate); syntax .DefineServerOption() .DefineKeyOption() .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId) .DefineParameter(DomainParam, help: Strings.HelpDomain) .DefineParameter(ChallengeTypeParam, help: Strings.HelpChallengeType); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandAzureApp); DefineAzureOptions(syntax) .DefineOption(SlotOption, help: Strings.HelpSlot) .DefineOption(PrivateKeyOption, help: Strings.HelpPrivateKey) .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId) .DefineParameter(DomainParam, help: Strings.HelpDomain) .DefineParameter(AppNameParam, help: Strings.HelpAppName); return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandOrderFinalize); syntax .DefineServerOption() .DefineKeyOption() .DefineOption(DnOption, help: Strings.HelpDn) .DefineOption(OutOption, help: Strings.HelpKeyOut) .DefineOption(PrivateKeyOption, help: Strings.HelpPrivateKey) .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId); return(cmd); }
public virtual void ParseCommandLine(ArgumentSyntax syntax) { ArgumentCommand command = syntax.DefineCommand(CommandName, this); command.Help = CommandHelp; bool isDryRun = false; syntax.DefineOption("dry-run", ref isDryRun, "Dry run of what images get built and order they would get built in"); IsDryRun = isDryRun; string manifest = "manifest.json"; syntax.DefineOption("manifest", ref manifest, "Path to json file which describes the repo"); Manifest = manifest; string registryOverride = null; syntax.DefineOption("registry-override", ref registryOverride, "Alternative registry which overrides the manifest"); RegistryOverride = registryOverride; string repo = null; syntax.DefineOption("repo", ref repo, "Repo to operate on (Default is all)"); Repo = repo; IReadOnlyList <string> repoOverrides = Array.Empty <string>(); syntax.DefineOptionList("repo-override", ref repoOverrides, "Alternative repos which overrides the manifest (<target repo>=<override>)"); RepoOverrides = repoOverrides .Select(pair => pair.Split(new char[] { '=' }, 2)) .ToDictionary(split => split[0], split => split[1]); string repoPrefix = null; syntax.DefineOption("repo-prefix", ref repoPrefix, "Prefix to add to the repo names specified in the manifest"); RepoPrefix = repoPrefix; IReadOnlyList <string> variables = Array.Empty <string>(); syntax.DefineOptionList("var", ref variables, "Named variables to substitute into the manifest (<name>=<value>)"); Variables = variables .Select(pair => pair.Split(new char[] { '=' }, 2)) .ToDictionary(split => split[0], split => split[1]); bool isVerbose = false; syntax.DefineOption("verbose", ref isVerbose, "Show details about the tasks run"); IsVerbose = isVerbose; }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandOrderNew); syntax .DefineServerOption() .DefineKeyOption(); var domainsParam = syntax.DefineParameterList("domains", new string[0]); domainsParam.Help = Strings.HelpDomains; return(cmd); }
public ArgumentCommand <string> Define(ArgumentSyntax syntax) { var cmd = syntax.DefineCommand(CommandText, help: Strings.HelpCommandCertificatePfx); syntax .DefineServerOption() .DefineKeyOption() .DefineOption(OutOption, help: Strings.HelpCertificateOut) .DefineOption(PrivateKeyOption, help: Strings.HelpPrivateKey) .DefineOption(FriendlyNameOption, help: Strings.HelpFriendlyName) .DefineOption(IssuerOption, help: Strings.HelpCertificateIssuer) .DefineUriParameter(OrderIdParam, help: Strings.HelpOrderId) .DefineParameter(PasswordParam, help: Strings.HelpPfxPassword); return(cmd); }
private RegisterOptions DefineRegisterCommand(ArgumentSyntax syntax) { var options = new RegisterOptions(); syntax.DefineCommand("register", ref command, Command.Register, "Create a new registration."); syntax.DefineOption("m|email", ref options.Email, "Email used for registration and recovery contact. (default: None)"); syntax.DefineOption("register-unsafely-without-email", ref options.NoEmail, "Create registration without email."); syntax.DefineOption("agree-tos", ref options.AgreeTos, $"Agree to the ACME Subscriber Agreement (default: {options.AgreeTos})"); syntax.DefineOption("update-registration", ref options.Update, $"With the register verb, indicates that details associated with an existing registration, such as the e-mail address, should be updated, rather than registering a new account. (default: None)"); syntax.DefineOption("thumbprint", ref options.Thumbprint, $"Print thumbprint of the account."); syntax.DefineOption("server", ref options.Server, s => new Uri(s), $"ACME Directory Resource URI. (default: {options.Server})"); syntax.DefineOption("p|path", ref options.Path, $"File path used to load/save the registration. (default: {options.Path})"); syntax.DefineOption("f|force", ref options.Force, $"If registering new account, overwrite the existing configuration if needed."); return(options); }
private AuthorizationOptions DefineAuthorizationCommand(ArgumentSyntax syntax) { var options = new AuthorizationOptions(); syntax.DefineCommand("authz", ref command, Command.Authorization, "Perform identifier authorization."); syntax.DefineOption("t|type", ref options.Type, "Type of authorization challenge to process. (default: None)"); syntax.DefineOptionList("v|value", ref options.Values, $"One or more names for authorization."); syntax.DefineOption("value-path", ref options.ValuesFile, $"The path of file contains one or more names for authorization."); syntax.DefineOption("complete-authz", ref options.Complete, $"Complete authz."); syntax.DefineOption("k|key-authz", ref options.KeyAuthentication, $"Print key authz."); syntax.DefineOption("r|refresh", ref options.Refresh, $"Print key authz."); syntax.DefineOption("server", ref options.Server, s => new Uri(s), $"ACME Directory Resource URI. (default: {options.Server})"); syntax.DefineOption("p|path", ref options.Path, $"File path used to load/save the registration. (default: {options.Path})"); syntax.DefineOption("f|force", ref options.Force, $"Force"); return(options); }
public virtual void ParseCommandLine(ArgumentSyntax syntax) { ArgumentCommand command = syntax.DefineCommand(CommandName, this); command.Help = CommandHelp; bool isDryRun = false; syntax.DefineOption("dry-run", ref isDryRun, "Dry run of what images get built and order they would get built in"); IsDryRun = isDryRun; string manifest = "manifest.json"; syntax.DefineOption("manifest", ref manifest, "Path to json file which describes the repo"); Manifest = manifest; string repo = null; syntax.DefineOption("repo", ref repo, "Repo to operate on (Default is all)"); Repo = repo; }
private static void AddCommand(ArgumentSyntax syntax, string name, Command command, string help) => syntax.DefineCommand(name, ref Command, command, help);
void DefineArgumentSyntax(ArgumentSyntax syntax) { bool activeCommandIsCommandAssociatedWithTraceProcessing = false; syntax.ApplicationName = typeof(Program).Assembly.GetName().Name.ToString(); // HandleHelp writes to error, fails fast with crash dialog and lacks custom formatting. syntax.HandleHelp = false; syntax.HandleErrors = false; string command = ""; void CommonOptions() { string traceFile = null; syntax.DefineOption( name: "t|trace", value: ref traceFile, help: "Specify the trace file to be parsed.", requireValue: true); if (traceFile != null) { TraceFile = new FileInfo(traceFile); } OutputOption(); int pidLocal = 0; if (syntax.DefineOption( name: "pid", value: ref pidLocal, help: "The pid within the trace of the process to examine. If this is a multi-process trace, at least one of --pid or --process-name must be specified", requireValue: true).IsSpecified) { Pid = pidLocal; } syntax.DefineOption( name: "process-name", value: ref ProcessName, help: "The process name within the trace of the process to examine. If this is a multi-process trace, at least one of --pid or --process-name must be specified.", requireValue: false); int clrInstanceIdLocal = 0; if (syntax.DefineOption( name: "clr-instance-id", value: ref clrInstanceIdLocal, help: "If the process contains multiple .NET runtimes, the instance ID must be specified.", requireValue: true).IsSpecified) { ClrInstanceId = clrInstanceIdLocal; } Reference = DefineFileOptionList(name: "r|reference", help: "If a reference is not located on disk at the same location as used in the process, it may be specified with a --reference parameter. Multiple --reference parameters may be specified. The wild cards * and ? are supported by this option."); ExcludeEventsBefore = Double.MinValue; syntax.DefineOption( name: "exclude-events-before", value: ref ExcludeEventsBefore, help: "Exclude data from events before specified time. Time is specified as milliseconds from the start of the trace.", valueConverter: Convert.ToDouble, requireValue: true); ExcludeEventsAfter = Double.MaxValue; syntax.DefineOption( name: "exclude-events-after", value: ref ExcludeEventsAfter, help: "Exclude data from events after specified time. Time is specified as milliseconds from the start of the trace.", valueConverter: Convert.ToDouble, requireValue: true); VerbosityOption(); } void OutputOption() { string outputFile = null; syntax.DefineOption( name: "o|output", value: ref outputFile, help: "Specify the output filename to be created.", requireValue: true); if (outputFile != null) { OutputFileName = new FileInfo(outputFile); } } void VerbosityOption() { Verbosity verbosity = Verbosity.normal; syntax.DefineOption(name: "v|verbosity", value: ref verbosity, help: "Adjust verbosity level. Supported levels are minimal, normal, detailed, and diagnostic.", valueConverter: VerbosityConverter, requireValue: true); BasicProgressMessages = (int)verbosity >= (int)Verbosity.normal; Warnings = (int)verbosity >= (int)Verbosity.normal; VerboseWarnings = (int)verbosity >= (int)Verbosity.detailed; DetailedProgressMessages = (int)verbosity >= (int)Verbosity.detailed; DisplayProcessedEvents = (int)verbosity >= (int)Verbosity.diagnostic; } void CompressedOption() { bool compressed = false; syntax.DefineOption(name: "compressed", value: ref compressed, help: "Generate compressed mibc", requireValue: false); Uncompressed = !compressed; } void HelpOption() { syntax.DefineOption("h|help", ref Help, "Display this usage message."); } var mibcCommand = syntax.DefineCommand(name: "create-mibc", value: ref command, help: "Transform a trace file into a Mibc profile data file."); if (mibcCommand.IsActive) { activeCommandIsCommandAssociatedWithTraceProcessing = true; HelpArgs = new string[] { "create-mibc", "--help", "--trace", "trace", "--output", "output" }; FileType = PgoFileType.mibc; GenerateCallGraph = true; ProcessJitEvents = true; ProcessR2REvents = true; #if DEBUG ValidateOutputFile = true; #else ValidateOutputFile = false; #endif CommonOptions(); CompressedOption(); string preciseDebugInfoFile = null; syntax.DefineOption(name: "precise-debug-info-file", ref preciseDebugInfoFile, "Name of file of newline separated JSON objects containing precise debug info"); if (preciseDebugInfoFile != null) { PreciseDebugInfoFile = new FileInfo(preciseDebugInfoFile); } syntax.DefineOption(name: "spgo", value: ref Spgo, help: "Base profile on samples in the input. Uses last branch records if available and otherwise raw IP samples.", requireValue: false); syntax.DefineOption(name: "spgo-min-samples", value: ref SpgoMinSamples, help: $"The minimum number of total samples a function must have before generating profile data for it with SPGO. Default: {SpgoMinSamples}", requireValue: false); syntax.DefineOption(name: "include-full-graphs", value: ref IncludeFullGraphs, help: "Include all blocks and edges in the written .mibc file, regardless of profile counts", requireValue: false); HelpOption(); } JitTraceOptions = JitTraceOptions.none; #if DEBUG // Usage of the jittrace format requires using logic embedded in the runtime repository and isn't suitable for general consumer use at this time // Build it in debug and check builds to ensure that it doesn't bitrot, and remains available for use by developers willing to build the repo var jittraceCommand = syntax.DefineCommand(name: "create-jittrace", value: ref command, help: "Transform a trace file into a jittrace runtime file."); if (jittraceCommand.IsActive) { activeCommandIsCommandAssociatedWithTraceProcessing = true; HelpArgs = new string[] { "create-jittrace", "--help", "--trace", "trace", "--output", "output" }; FileType = PgoFileType.jittrace; ProcessJitEvents = true; ProcessR2REvents = false; ValidateOutputFile = false; CommonOptions(); bool sorted = false; syntax.DefineOption(name: "sorted", value: ref sorted, help: "Generate sorted output.", requireValue: false); if (sorted) { JitTraceOptions |= JitTraceOptions.sorted; } bool showtimestamp = false; syntax.DefineOption(name: "showtimestamp", value: ref showtimestamp, help: "Show timestamps in output.", requireValue: false); if (showtimestamp) { JitTraceOptions |= JitTraceOptions.showtimestamp; } syntax.DefineOption(name: "includeReadyToRun", value: ref ProcessR2REvents, help: "Include ReadyToRun methods in the trace file.", requireValue: false); HelpOption(); } #endif var mergeCommand = syntax.DefineCommand(name: "merge", value: ref command, help: "Merge multiple Mibc profile data files into one file."); if (mergeCommand.IsActive) { HelpArgs = new string[] { "merge", "--help", "--output", "output", "--input", "input" }; InputFilesToMerge = DefineFileOptionList(name: "i|input", help: "Input .mibc files to be merged. Multiple input arguments are specified as --input file1.mibc --input file2.mibc"); OutputOption(); IReadOnlyList <string> assemblyNamesAsStrings = null; syntax.DefineOptionList(name: "include-reference", value: ref assemblyNamesAsStrings, help: "If specified, include in Mibc file only references to the specified assemblies. Assemblies are specified as assembly names, not filenames. For instance, `System.Private.CoreLib` not `System.Private.CoreLib.dll`. Multiple --include-reference options may be specified.", requireValue: true); if (assemblyNamesAsStrings != null) { foreach (string asmName in assemblyNamesAsStrings) { try { IncludedAssemblies.Add(new AssemblyName(asmName)); } catch { throw new FormatException($"Unable to parse '{asmName}' as an Assembly Name."); } } } syntax.DefineOption(name: "inherit-timestamp", value: ref InheritTimestamp, help: "If specified, set the output's timestamp to the max timestamp of the input files"); VerbosityOption(); CompressedOption(); HelpOption(); #if DEBUG ValidateOutputFile = true; #else ValidateOutputFile = false; #endif } var dumpCommand = syntax.DefineCommand(name: "dump", value: ref command, help: "Dump the contents of a Mibc file."); if (dumpCommand.IsActive) { DumpMibc = true; HelpArgs = new string[] { "dump", "--help", "input", "output" }; VerbosityOption(); HelpOption(); string inputFileToDump = null; syntax.DefineParameter(name: "input", ref inputFileToDump, "Name of the input mibc file to dump."); if (inputFileToDump != null) { InputFileToDump = new FileInfo(inputFileToDump); } string outputFile = null; syntax.DefineParameter(name: "output", ref outputFile, "Name of the output dump file."); if (outputFile != null) { OutputFileName = new FileInfo(outputFile); } } var compareMibcCommand = syntax.DefineCommand(name: "compare-mibc", value: ref command, help: "Compare two .mibc files"); if (compareMibcCommand.IsActive) { HelpArgs = new[] { "compare-mibc", "--input", "first.mibc", "--input", "second.mibc" }; CompareMibc = DefineFileOptionList(name: "i|input", help: "The input .mibc files to be compared. Specify as --input file1.mibc --input file2.mibc"); if (CompareMibc.Count != 2) { Help = true; } syntax.DefineOption(name: "dump-worst-overlap-graphs", value: ref DumpWorstOverlapGraphs, help: "Number of graphs to dump to .dot format in dump-worst-overlap-graphs-to directory"); string dumpWorstOverlapGraphsTo = null; syntax.DefineOption(name: "dump-worst-overlap-graphs-to", value: ref dumpWorstOverlapGraphsTo, help: "Number of graphs to dump to .dot format in dump-worst-overlap-graphs-to directory"); if (dumpWorstOverlapGraphsTo != null) { DumpWorstOverlapGraphsTo = new DirectoryInfo(dumpWorstOverlapGraphsTo); } } if (syntax.ActiveCommand == null) { // No command specified Help = true; } if (activeCommandIsCommandAssociatedWithTraceProcessing) { HelpText = @$ "{syntax.GetHelpText()} Example tracing commands used to generate the input to this tool: " "dotnet-trace collect -p 73060 --providers Microsoft-Windows-DotNETRuntime:0x1E000080018:4" " - Capture events from process 73060 where we capture both JIT and R2R events using EventPipe tracing " "dotnet-trace collect -p 73060 --providers Microsoft-Windows-DotNETRuntime:0x1C000080018:4" " - Capture events from process 73060 where we capture only JIT events using EventPipe tracing " "perfview collect -LogFile:logOfCollection.txt -DataFile:jittrace.etl -Zip:false -merge:false -providers:Microsoft-Windows-DotNETRuntime:0x1E000080018:4" " - Capture Jit and R2R events via perfview of all processes running using ETW tracing "; } else { HelpText = syntax.GetHelpText(); } List <FileInfo> DefineFileOptionList(string name, string help) { IReadOnlyList <string> filesAsStrings = null; syntax.DefineOptionList(name: name, value: ref filesAsStrings, help: help, requireValue: true); List <FileInfo> referenceList = new List <FileInfo>(); if (filesAsStrings != null) { foreach (string pattern in filesAsStrings) { Dictionary <string, string> paths = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); Helpers.AppendExpandedPaths(paths, pattern, false); foreach (string file in paths.Values) { referenceList.Add(new FileInfo(file)); } } } return(referenceList); } }
void DefineArgumentSyntax(ArgumentSyntax syntax) { bool activeCommandIsCommandAssociatedWithTraceProcessing = false; syntax.ApplicationName = typeof(Program).Assembly.GetName().Name.ToString(); // HandleHelp writes to error, fails fast with crash dialog and lacks custom formatting. syntax.HandleHelp = false; syntax.HandleErrors = false; string command = ""; void CommonOptions() { string traceFile = null; FailIfUnspecified(syntax.DefineOption( name: "t|trace", value: ref traceFile, help: "Specify the trace file to be parsed.", requireValue: true)); if (traceFile != null) { TraceFile = new FileInfo(traceFile); } string outputFile = null; FailIfUnspecified(syntax.DefineOption( name: "o|output", value: ref outputFile, help: "Specify the output filename to be created.", requireValue: true)); if (outputFile != null) { OutputFileName = new FileInfo(outputFile); } int pidLocal = 0; if (syntax.DefineOption( name: "pid", value: ref pidLocal, help: "The pid within the trace of the process to examine. If this is a multi-process trace, at least one of --pid or --process-name must be specified", requireValue: true).IsSpecified) { Pid = pidLocal; } syntax.DefineOption( name: "process-name", value: ref ProcessName, help: "The process name within the trace of the process to examine. If this is a multi-process trace, at least one of --pid or --process-name must be specified.", requireValue: false); int clrInstanceIdLocal = 0; if (syntax.DefineOption( name: "clr-instance-id", value: ref clrInstanceIdLocal, help: "If the process contains multiple .NET runtimes, the instance ID must be specified.", requireValue: true).IsSpecified) { ClrInstanceId = clrInstanceIdLocal; } IReadOnlyList <string> referencesAsStrings = null; syntax.DefineOptionList(name: "r|reference", value: ref referencesAsStrings, help: "If a reference is not located on disk at the same location as used in the process, it may be specified with a --reference parameter. Multiple --reference parameters may be specified. The wild cards * and ? are supported by this option.", requireValue: true); List <FileInfo> referenceList = new List <FileInfo>(); Reference = referenceList; if (referencesAsStrings != null) { foreach (string pattern in referencesAsStrings) { Dictionary <string, string> paths = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); Helpers.AppendExpandedPaths(paths, pattern, false); foreach (string file in paths.Values) { referenceList.Add(new FileInfo(file)); } } } syntax.DefineOption( name: "exclude-events-before", value: ref ExcludeEventsBefore, help: "Exclude data from events before specified time. Time is specified as milliseconds from the start of the trace.", valueConverter: Convert.ToDouble, requireValue: true); syntax.DefineOption( name: "exclude-events-after", value: ref ExcludeEventsAfter, help: "Exclude data from events after specified time. Time is specified as milliseconds from the start of the trace.", valueConverter: Convert.ToDouble, requireValue: true); Verbosity verbosity = default(Verbosity); syntax.DefineOption(name: "v|verbosity", value: ref verbosity, help: "Adjust verbosity level. Supported levels are minimal, normal, detailed, and diagnostic.", valueConverter: VerbosityConverter, requireValue: true); BasicProgressMessages = (int)verbosity >= (int)Verbosity.normal; Warnings = (int)verbosity >= (int)Verbosity.normal; VerboseWarnings = (int)verbosity >= (int)Verbosity.detailed; DisplayProcessedEvents = (int)verbosity >= (int)Verbosity.diagnostic; } void HelpOption() { syntax.DefineOption("h|help", ref Help, "Display this usage message."); } var mibcCommand = syntax.DefineCommand(name: "create-mibc", value: ref command, help: "Transform a trace file into a Mibc profile data file."); if (mibcCommand.IsActive) { activeCommandIsCommandAssociatedWithTraceProcessing = true; HelpArgs = new string[] { "create-mibc", "--help", "--trace", "trace", "--output", "output" }; FileType = PgoFileType.mibc; GenerateCallGraph = true; ProcessJitEvents = true; ProcessR2REvents = true; #if Debug ValidateOutputFile = true; #else ValidateOutputFile = false; #endif CommonOptions(); bool compressed = false; syntax.DefineOption(name: "compressed", value: ref compressed, help: "Generate compressed mibc", requireValue: false); Uncompressed = !compressed; HelpOption(); } JitTraceOptions = jittraceoptions.none; #if DEBUG // Usage of the jittrace format requires using logic embedded in the runtime repository and isn't suitable for general consumer use at this time // Build it in debug and check builds to ensure that it doesn't bitrot, and remains available for use by developers willing to build the repo var jittraceCommand = syntax.DefineCommand(name: "create-jittrace", value: ref command, help: "Transform a trace file into a jittrace runtime file."); if (jittraceCommand.IsActive) { activeCommandIsCommandAssociatedWithTraceProcessing = true; HelpArgs = new string[] { "create-jittrace", "--help", "--trace", "trace", "--output", "output" }; FileType = PgoFileType.jittrace; ProcessJitEvents = true; ProcessR2REvents = false; ValidateOutputFile = false; CommonOptions(); bool sorted = false; syntax.DefineOption(name: "sorted", value: ref sorted, help: "Generate sorted output.", requireValue: false); if (sorted) { JitTraceOptions |= jittraceoptions.sorted; } bool showtimestamp = false; syntax.DefineOption(name: "showtimestamp", value: ref showtimestamp, help: "Show timestamps in output.", requireValue: false); if (showtimestamp) { JitTraceOptions |= jittraceoptions.showtimestamp; } syntax.DefineOption(name: "includeReadyToRun", value: ref ProcessR2REvents, help: "Include ReadyToRun methods in the trace file.", requireValue: false); HelpOption(); } #endif if (syntax.ActiveCommand == null) { // No command specified Help = true; } if (activeCommandIsCommandAssociatedWithTraceProcessing) { HelpText = @$ "{syntax.GetHelpText()} Example tracing commands used to generate the input to this tool: " "dotnet-trace collect -p 73060 --providers Microsoft-Windows-DotNETRuntime:0x1E000080018:4" " - Capture events from process 73060 where we capture both JIT and R2R events using EventPipe tracing " "dotnet-trace collect -p 73060 --providers Microsoft-Windows-DotNETRuntime:0x1C000080018:4" " - Capture events from process 73060 where we capture only JIT events using EventPipe tracing " "perfview collect -LogFile:logOfCollection.txt -DataFile:jittrace.etl -Zip:false -merge:false -providers:Microsoft-Windows-DotNETRuntime:0x1E000080018:4" " - Capture Jit and R2R events via perfview of all processes running using ETW tracing "; } else { HelpText = syntax.GetHelpText(); } }