Re: [PATCH 3/3] rtla: Parse cmdline using libsubcmd
From: Wander Lairson Costa
Date: Fri Mar 20 2026 - 13:39:34 EST
On Fri, Mar 20, 2026 at 04:06:51PM +0100, Tomas Glozar wrote:
> Instead of using getopt_long() directly to parse the command line
> arguments given to an RTLA tool, use libsubcmd's parse_options().
>
> Utilizing libsubcmd for parsing command line arguments has several
> benefits:
>
> - A help message is automatically generated by libsubcmd from the
> specification, removing the need of writing it by hand.
> - Options are sorted into groups based on which part of tracing (CPU,
> thread, auto-analysis, tuning, histogram) they relate to.
> - Common parsing patterns for numerical and boolean values now share
> code, with the target variable being stored in the option array.
>
> To avoid duplication of the option parsing logic, RTLA-specific
> macros defining struct option values are created:
>
> - RTLA_OPT_* for options common to all tools
> - OSNOISE_OPT_* and TIMERLAT_OPT_* for options specific to
[snip]
> -int getopt_auto(int argc, char **argv, const struct option *long_opts);
> int common_parse_options(int argc, char **argv, struct common_params *common);
The function common_parse_options() body was removed, but the declaration remains.
> int common_apply_config(struct osnoise_tool *tool, struct common_params *params);
[snip]