Linux Trace Kernel
 help / color / mirror / Atom feed
From: Costa Shulyupin <costa.shul@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Tomas Glozar <tglozar@redhat.com>,
	Costa Shulyupin <costa.shul@redhat.com>,
	Crystal Wood <crwood@redhat.com>,
	Wander Lairson Costa <wander@redhat.com>,
	Ivan Pravdin <ipravdin.official@gmail.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 0/8] tools/rtla: Consolidate common command line options
Date: Fri, 21 Nov 2025 19:44:56 +0200	[thread overview]
Message-ID: <20251121174504.519230-1-costa.shul@redhat.com> (raw)

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


             reply	other threads:[~2025-11-21 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21 17:44 Costa Shulyupin [this message]
2025-11-21 17:44 ` [PATCH v1 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
2025-11-21 17:44 ` [PATCH v1 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
2025-11-21 17:44 ` [PATCH v1 3/8] tools/rtla: Consolidate -C/--cgroup " Costa Shulyupin
2025-11-21 17:45 ` [PATCH v1 4/8] tools/rtla: Consolidate -D/--debug " Costa Shulyupin
2025-11-21 17:45 ` [PATCH v1 5/8] tools/rtla: Consolidate -d/--duration " Costa Shulyupin
2025-11-21 17:45 ` [PATCH v1 6/8] tools/rtla: Consolidate -e/--event " Costa Shulyupin
2025-11-21 17:45 ` [PATCH v1 7/8] tools/rtla: Consolidate -P/--priority " Costa Shulyupin
2025-11-21 17:45 ` [PATCH v1 8/8] tools/rtla: Consolidate -H/--house-keeping " Costa Shulyupin
2025-11-25  1:01 ` [PATCH v1 0/8] tools/rtla: Consolidate common command line options Crystal Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251121174504.519230-1-costa.shul@redhat.com \
    --to=costa.shul@redhat.com \
    --cc=crwood@redhat.com \
    --cc=ipravdin.official@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglozar@redhat.com \
    --cc=wander@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox