[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251121174504.519230-1-costa.shul@redhat.com>
Date: Fri, 21 Nov 2025 19:44:56 +0200
From: Costa Shulyupin <costa.shul@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Tomas Glozar <tglozar@...hat.com>,
Costa Shulyupin <costa.shul@...hat.com>,
Crystal Wood <crwood@...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: [PATCH v1 0/8] tools/rtla: Consolidate common command line options
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(-)
--
2.51.1
Powered by blists - more mailing lists