[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e58d366c0eec0efb602293f502f64be2df39ea89.camel@redhat.com>
Date: Mon, 24 Nov 2025 19:01:41 -0600
From: Crystal Wood <crwood@...hat.com>
To: Costa Shulyupin <costa.shul@...hat.com>, Steven Rostedt
<rostedt@...dmis.org>, Tomas Glozar <tglozar@...hat.com>, Wander Lairson
Costa <wander@...hat.com>, Ivan Pravdin <ipravdin.official@...il.com>,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 0/8] tools/rtla: Consolidate common command line
options
On Fri, 2025-11-21 at 19:44 +0200, Costa Shulyupin wrote:
> Argument parsing functions are the longest functions of the project:
>
> lizard --warnings_only --sort nloc -L100 | head -n 4
> ./src/timerlat_hist.c:766: warning: timerlat_hist_parse_args has 247 NLOC, 76 CCN, 1579 token, 1 PARAM, 287 length, 0 ND
> ./src/timerlat_top.c:538: warning: timerlat_top_parse_args has 217 NLOC, 64 CCN, 1338 token, 2 PARAM, 262 length, 0 ND
> ./src/osnoise_hist.c:469: warning: osnoise_hist_parse_args has 195 NLOC, 56 CCN, 1225 token, 1 PARAM, 216 length, 0 ND
> ./src/osnoise_top.c:322: warning: osnoise_top_parse_args has 169 NLOC, 46 CCN, 1019 token, 2 PARAM, 191 length, 0 ND
>
> Moreover, they contain a lot of duplicate code and growing.
>
> Refactor these functions to reduce code duplication.
>
> Benefits:
> - Single implementation for common options
> - Easier maintenance and consistent behavior
>
> Costa Shulyupin (8):
> tools/rtla: Add common_parse_options()
> tools/rtla: Consolidate -c/--cpus option parsing
> tools/rtla: Consolidate -C/--cgroup option parsing
> tools/rtla: Consolidate -D/--debug option parsing
> tools/rtla: Consolidate -d/--duration option parsing
> tools/rtla: Consolidate -e/--event option parsing
> tools/rtla: Consolidate -P/--priority option parsing
> tools/rtla: Consolidate -H/--house-keeping option parsing
>
> tools/tracing/rtla/src/common.c | 78 ++++++++++++++++++++++++++
> tools/tracing/rtla/src/common.h | 1 +
> tools/tracing/rtla/src/osnoise_hist.c | 53 ++---------------
> tools/tracing/rtla/src/osnoise_top.c | 53 ++---------------
> tools/tracing/rtla/src/timerlat_hist.c | 53 ++---------------
> tools/tracing/rtla/src/timerlat_top.c | 52 ++---------------
> 6 files changed, 95 insertions(+), 195 deletions(-)
Reviewed-by: Crystal Wood <crwood@...hat.com>
-Crystal
Powered by blists - more mailing lists