[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251121174504.519230-9-costa.shul@redhat.com>
Date: Fri, 21 Nov 2025 19:45:04 +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 8/8] tools/rtla: Consolidate -H/--house-keeping option parsing
Each rtla tool duplicates parsing of -H/--house-keeping.
Migrate the option parsing from individual tools to the
common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@...hat.com>
---
tools/tracing/rtla/src/common.c | 8 +++++++-
tools/tracing/rtla/src/osnoise_hist.c | 9 +--------
tools/tracing/rtla/src/osnoise_top.c | 9 +--------
tools/tracing/rtla/src/timerlat_hist.c | 9 +--------
tools/tracing/rtla/src/timerlat_top.c | 9 +--------
5 files changed, 11 insertions(+), 33 deletions(-)
diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index dd67c6b47eaa..9d047a64146b 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -62,12 +62,13 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
{"debug", no_argument, 0, 'D'},
{"duration", required_argument, 0, 'd'},
{"event", required_argument, 0, 'e'},
+ {"house-keeping", required_argument, 0, 'H'},
{"priority", required_argument, 0, 'P'},
{0, 0, 0, 0}
};
opterr = 0;
- c = getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL);
+ c = getopt_long(argc, argv, "c:C::Dd:e:H:P:", long_options, NULL);
switch (c) {
case 'c':
@@ -96,6 +97,11 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
tevent->next = common->events;
common->events = tevent;
break;
+ case 'H':
+ common->hk_cpus = 1;
+ if (parse_cpu_set(optarg, &common->hk_cpu_set))
+ fatal("Error parsing house keeping CPUs");
+ break;
case 'P':
if (parse_prio(optarg, &common->sched_param) == -1)
fatal("Invalid -P priority");
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 6ed5f5594960..1ebd3b48b2d3 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -490,7 +490,6 @@ static struct common_params
{"auto", required_argument, 0, 'a'},
{"bucket-size", required_argument, 0, 'b'},
{"entries", required_argument, 0, 'E'},
- {"house-keeping", required_argument, 0, 'H'},
{"help", no_argument, 0, 'h'},
{"period", required_argument, 0, 'p'},
{"runtime", required_argument, 0, 'r'},
@@ -514,7 +513,7 @@ static struct common_params
if (common_parse_options(argc, argv, ¶ms->common))
continue;
- c = getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:",
+ c = getopt_long(argc, argv, "a:b:E:hp:r:s:S:t::T:01234:5:6:7:",
long_options, NULL);
/* detect the end of the options. */
@@ -550,12 +549,6 @@ static struct common_params
case '?':
osnoise_hist_usage();
break;
- case 'H':
- params->common.hk_cpus = 1;
- retval = parse_cpu_set(optarg, ¶ms->common.hk_cpu_set);
- if (retval)
- fatal("Error parsing house keeping CPUs");
- break;
case 'p':
params->period = get_llong_from_str(optarg);
if (params->period > 10000000)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index d2dfad960440..02e5e6e18e8d 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -345,7 +345,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
while (1) {
static struct option long_options[] = {
{"auto", required_argument, 0, 'a'},
- {"house-keeping", required_argument, 0, 'H'},
{"help", no_argument, 0, 'h'},
{"period", required_argument, 0, 'p'},
{"quiet", no_argument, 0, 'q'},
@@ -366,7 +365,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
if (common_parse_options(argc, argv, ¶ms->common))
continue;
- c = getopt_long(argc, argv, "a:hH:p:qr:s:S:t::T:0:1:2:3:",
+ c = getopt_long(argc, argv, "a:hp:qr:s:S:t::T:0:1:2:3:",
long_options, NULL);
/* Detect the end of the options. */
@@ -390,12 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
case '?':
osnoise_top_usage(params);
break;
- case 'H':
- params->common.hk_cpus = 1;
- retval = parse_cpu_set(optarg, ¶ms->common.hk_cpu_set);
- if (retval)
- fatal("Error parsing house keeping CPUs");
- break;
case 'p':
params->period = get_llong_from_str(optarg);
if (params->period > 10000000)
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index e7ba083b5eb4..d1a6cf0c2e0d 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -797,7 +797,6 @@ static struct common_params
{"auto", required_argument, 0, 'a'},
{"bucket-size", required_argument, 0, 'b'},
{"entries", required_argument, 0, 'E'},
- {"house-keeping", required_argument, 0, 'H'},
{"help", no_argument, 0, 'h'},
{"irq", required_argument, 0, 'i'},
{"nano", no_argument, 0, 'n'},
@@ -830,7 +829,7 @@ static struct common_params
if (common_parse_options(argc, argv, ¶ms->common))
continue;
- c = getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
+ c = getopt_long(argc, argv, "a:b:E:hi:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
long_options, NULL);
/* detect the end of the options. */
@@ -869,12 +868,6 @@ static struct common_params
case '?':
timerlat_hist_usage();
break;
- case 'H':
- params->common.hk_cpus = 1;
- retval = parse_cpu_set(optarg, ¶ms->common.hk_cpu_set);
- if (retval)
- fatal("Error parsing house keeping CPUs");
- break;
case 'i':
params->common.stop_us = get_llong_from_str(optarg);
break;
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 8250bea4b2fd..12e3d8c6f850 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -566,7 +566,6 @@ static struct common_params
static struct option long_options[] = {
{"auto", required_argument, 0, 'a'},
{"help", no_argument, 0, 'h'},
- {"house-keeping", required_argument, 0, 'H'},
{"irq", required_argument, 0, 'i'},
{"nano", no_argument, 0, 'n'},
{"period", required_argument, 0, 'p'},
@@ -594,7 +593,7 @@ static struct common_params
if (common_parse_options(argc, argv, ¶ms->common))
continue;
- c = getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:",
+ c = getopt_long(argc, argv, "a:hi:knp:qs:t::T:uU0:1:2:345:6:7:",
long_options, NULL);
/* detect the end of the options. */
@@ -635,12 +634,6 @@ static struct common_params
case '?':
timerlat_top_usage();
break;
- case 'H':
- params->common.hk_cpus = 1;
- retval = parse_cpu_set(optarg, ¶ms->common.hk_cpu_set);
- if (retval)
- fatal("Error parsing house keeping CPUs");
- break;
case 'i':
params->common.stop_us = get_llong_from_str(optarg);
break;
--
2.51.1
Powered by blists - more mailing lists