Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v2 1/8] tools/rtla: Add common_parse_options()
@ 2025-12-09 10:00 Costa Shulyupin
  2025-12-09 10:00 ` [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of many common options. This creates
maintenance overhead and risks inconsistencies when updating these
options.

Add common_parse_options() to centralize parsing of options used across
all tools.

Common options to be migrated in future patches.

Changes since v1:
- restore opterr

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/src/common.c        | 35 ++++++++++++++++++++++++++
 tools/tracing/rtla/src/common.h        |  1 +
 tools/tracing/rtla/src/osnoise_hist.c  |  3 +++
 tools/tracing/rtla/src/osnoise_top.c   |  3 +++
 tools/tracing/rtla/src/timerlat_hist.c |  3 +++
 tools/tracing/rtla/src/timerlat_top.c  |  3 +++
 6 files changed, 48 insertions(+)

diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index b197037fc58b..a78f9883521e 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -5,6 +5,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <getopt.h>
 #include "common.h"
 
 struct trace_instance *trace_inst;
@@ -37,6 +38,40 @@ static void set_signals(struct common_params *params)
 	}
 }
 
+/*
+ * common_parse_options - parse common command line options
+ *
+ * @argc: argument count
+ * @argv: argument vector
+ * @common: common parameters structure
+ *
+ * Parse command line options that are common to all rtla tools.
+ *
+ * Returns: non zero if a common option was parsed, or 0
+ * if the option should be handled by tool-specific parsing.
+ */
+int common_parse_options(int argc, char **argv, struct common_params *common)
+{
+	int saved_state = optind;
+	int c;
+
+	static struct option long_options[] = {
+		{0, 0, 0, 0}
+	};
+
+	opterr = 0;
+	c = getopt_long(argc, argv, "", long_options, NULL);
+	opterr = 1;
+
+	switch (c) {
+	default:
+		optind = saved_state;
+		return 0;
+	}
+
+	return c;
+}
+
 /*
  * common_apply_config - apply common configs to the initialized tool
  */
diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/common.h
index 9ec2b7632c37..1066d777a823 100644
--- a/tools/tracing/rtla/src/common.h
+++ b/tools/tracing/rtla/src/common.h
@@ -153,6 +153,7 @@ struct osnoise_tool *osnoise_init_tool(char *tool_name);
 struct osnoise_tool *osnoise_init_trace_tool(const char *tracer);
 bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record);
 
+int common_parse_options(int argc, char **argv, struct common_params *common);
 int common_apply_config(struct osnoise_tool *tool, struct common_params *params);
 int top_main_loop(struct osnoise_tool *tool);
 int hist_main_loop(struct osnoise_tool *tool);
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index ff8c231e47c4..35f4a068af95 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -518,6 +518,9 @@ static struct common_params
 			{0, 0, 0, 0}
 		};
 
+		if (common_parse_options(argc, argv, &params->common))
+			continue;
+
 		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 04c699bdd736..550731c7addd 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -370,6 +370,9 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			{0, 0, 0, 0}
 		};
 
+		if (common_parse_options(argc, argv, &params->common))
+			continue;
+
 		c = getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 1fb471a787b7..ffcfcabb9964 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -834,6 +834,9 @@ static struct common_params
 			{0, 0, 0, 0}
 		};
 
+		if (common_parse_options(argc, argv, &params->common))
+			continue;
+
 		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 29c2c1f717ed..d18d48671ccd 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -598,6 +598,9 @@ static struct common_params
 			{0, 0, 0, 0}
 		};
 
+		if (common_parse_options(argc, argv, &params->common))
+			continue;
+
 		c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:16   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup " Costa Shulyupin
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -c/--cpus.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.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 a78f9883521e..e5aa8c30cd7d 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -56,14 +56,20 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 	int c;
 
 	static struct option long_options[] = {
+		{"cpus",                required_argument,      0, 'c'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "", long_options, NULL);
+	c = getopt_long(argc, argv, "c:", long_options, NULL);
 	opterr = 1;
 
 	switch (c) {
+	case 'c':
+		if (parse_cpu_set(optarg, &common->monitored_cpus))
+			fatal("Invalid -c cpu list");
+		common->cpus = optarg;
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 35f4a068af95..9e721362989a 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -491,7 +491,6 @@ static struct common_params
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"entries",		required_argument,	0, 'E'},
-			{"cpus",		required_argument,	0, 'c'},
 			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
@@ -521,7 +520,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -547,12 +546,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'c':
-			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
-			if (retval)
-				fatal("Invalid -c cpu list");
-			params->common.cpus = optarg;
-			break;
 		case 'C':
 			params->common.cgroup = 1;
 			params->common.cgroup_name = parse_optional_arg(argc, argv);
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 550731c7addd..73736cefd992 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cpus",		required_argument,	0, 'c'},
 			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
@@ -373,7 +372,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -392,12 +391,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			if (!trace_output)
 				trace_output = "osnoise_trace.txt";
 
-			break;
-		case 'c':
-			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
-			if (retval)
-				fatal("Invalid -c cpu list");
-			params->common.cpus = optarg;
 			break;
 		case 'C':
 			params->common.cgroup = 1;
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index ffcfcabb9964..4ae77145adea 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -796,7 +796,6 @@ static struct common_params
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cpus",		required_argument,	0, 'c'},
 			{"cgroup",		optional_argument,	0, 'C'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"debug",		no_argument,		0, 'D'},
@@ -837,7 +836,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -859,12 +858,6 @@ static struct common_params
 			if (!trace_output)
 				trace_output = "timerlat_trace.txt";
 
-			break;
-		case 'c':
-			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
-			if (retval)
-				fatal("Invalid -c cpu list");
-			params->common.cpus = optarg;
 			break;
 		case 'C':
 			params->common.cgroup = 1;
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index d18d48671ccd..9774c26b27ff 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
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cpus",		required_argument,	0, 'c'},
 			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
@@ -601,7 +600,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -638,12 +637,6 @@ static struct common_params
 			/* set aa_only to avoid parsing the trace */
 			params->common.aa_only = 1;
 			break;
-		case 'c':
-			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
-			if (retval)
-				fatal("Invalid -c cpu list");
-			params->common.cpus = optarg;
-			break;
 		case 'C':
 			params->common.cgroup = 1;
 			params->common.cgroup_name = optarg;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
  2025-12-09 10:00 ` [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:17   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug " Costa Shulyupin
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -C/--cgroup.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/src/common.c        | 7 ++++++-
 tools/tracing/rtla/src/osnoise_hist.c  | 7 +------
 tools/tracing/rtla/src/osnoise_top.c   | 7 +------
 tools/tracing/rtla/src/timerlat_hist.c | 7 +------
 tools/tracing/rtla/src/timerlat_top.c  | 7 +------
 5 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index e5aa8c30cd7d..33428fa77f9f 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -57,11 +57,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 
 	static struct option long_options[] = {
 		{"cpus",                required_argument,      0, 'c'},
+		{"cgroup",              optional_argument,      0, 'C'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "c:", long_options, NULL);
+	c = getopt_long(argc, argv, "c:C::", long_options, NULL);
 	opterr = 1;
 
 	switch (c) {
@@ -70,6 +71,10 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 			fatal("Invalid -c cpu list");
 		common->cpus = optarg;
 		break;
+	case 'C':
+		common->cgroup = 1;
+		common->cgroup_name = parse_optional_arg(argc, argv);
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 9e721362989a..5cbe5e1f1b07 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -491,7 +491,6 @@ static struct common_params
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"entries",		required_argument,	0, 'E'},
-			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"house-keeping",	required_argument,		0, 'H'},
@@ -520,7 +519,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -546,10 +545,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'C':
-			params->common.cgroup = 1;
-			params->common.cgroup_name = parse_optional_arg(argc, argv);
-			break;
 		case 'D':
 			config_debug = 1;
 			break;
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 73736cefd992..35db5b73c0d7 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
@@ -372,7 +371,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -391,10 +390,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			if (!trace_output)
 				trace_output = "osnoise_trace.txt";
 
-			break;
-		case 'C':
-			params->common.cgroup = 1;
-			params->common.cgroup_name = parse_optional_arg(argc, argv);
 			break;
 		case 'D':
 			config_debug = 1;
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 4ae77145adea..9ecab2bb0f1e 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -796,7 +796,6 @@ static struct common_params
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cgroup",		optional_argument,	0, 'C'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"debug",		no_argument,		0, 'D'},
 			{"entries",		required_argument,	0, 'E'},
@@ -836,7 +835,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -858,10 +857,6 @@ static struct common_params
 			if (!trace_output)
 				trace_output = "timerlat_trace.txt";
 
-			break;
-		case 'C':
-			params->common.cgroup = 1;
-			params->common.cgroup_name = parse_optional_arg(argc, argv);
 			break;
 		case 'b':
 			params->common.hist.bucket_size = get_llong_from_str(optarg);
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 9774c26b27ff..6329c3a489aa 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
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"cgroup",		optional_argument,	0, 'C'},
 			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
@@ -600,7 +599,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -637,10 +636,6 @@ static struct common_params
 			/* set aa_only to avoid parsing the trace */
 			params->common.aa_only = 1;
 			break;
-		case 'C':
-			params->common.cgroup = 1;
-			params->common.cgroup_name = optarg;
-			break;
 		case 'D':
 			config_debug = 1;
 			break;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
  2025-12-09 10:00 ` [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
  2025-12-09 10:00 ` [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup " Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:17   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration " Costa Shulyupin
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -D/--debug.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/src/common.c        | 6 +++++-
 tools/tracing/rtla/src/osnoise_hist.c  | 6 +-----
 tools/tracing/rtla/src/osnoise_top.c   | 6 +-----
 tools/tracing/rtla/src/timerlat_hist.c | 6 +-----
 tools/tracing/rtla/src/timerlat_top.c  | 6 +-----
 5 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index 33428fa77f9f..5bf79a9bb152 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -58,11 +58,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 	static struct option long_options[] = {
 		{"cpus",                required_argument,      0, 'c'},
 		{"cgroup",              optional_argument,      0, 'C'},
+		{"debug",               no_argument,            0, 'D'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "c:C::", long_options, NULL);
+	c = getopt_long(argc, argv, "c:C::D", long_options, NULL);
 	opterr = 1;
 
 	switch (c) {
@@ -75,6 +76,9 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 		common->cgroup = 1;
 		common->cgroup_name = parse_optional_arg(argc, argv);
 		break;
+	case 'D':
+		config_debug = 1;
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 5cbe5e1f1b07..6902486fb144 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -491,7 +491,6 @@ static struct common_params
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"entries",		required_argument,	0, 'E'},
-			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"house-keeping",	required_argument,		0, 'H'},
 			{"help",		no_argument,		0, 'h'},
@@ -519,7 +518,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -545,9 +544,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'D':
-			config_debug = 1;
-			break;
 		case 'd':
 			params->common.duration = parse_seconds_duration(optarg);
 			if (!params->common.duration)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 35db5b73c0d7..4a61fd50b990 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
 			{"house-keeping",	required_argument,	0, 'H'},
@@ -371,7 +370,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -390,9 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			if (!trace_output)
 				trace_output = "osnoise_trace.txt";
 
-			break;
-		case 'D':
-			config_debug = 1;
 			break;
 		case 'd':
 			params->common.duration = parse_seconds_duration(optarg);
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 9ecab2bb0f1e..97d20e272583 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
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
-			{"debug",		no_argument,		0, 'D'},
 			{"entries",		required_argument,	0, 'E'},
 			{"duration",		required_argument,	0, 'd'},
 			{"house-keeping",	required_argument,	0, 'H'},
@@ -835,7 +834,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:b:d:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -864,9 +863,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'D':
-			config_debug = 1;
-			break;
 		case 'd':
 			params->common.duration = parse_seconds_duration(optarg);
 			if (!params->common.duration)
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 6329c3a489aa..96bca67d419f 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
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"debug",		no_argument,		0, 'D'},
 			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
 			{"help",		no_argument,		0, 'h'},
@@ -599,7 +598,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -636,9 +635,6 @@ static struct common_params
 			/* set aa_only to avoid parsing the trace */
 			params->common.aa_only = 1;
 			break;
-		case 'D':
-			config_debug = 1;
-			break;
 		case 'd':
 			params->common.duration = parse_seconds_duration(optarg);
 			if (!params->common.duration)
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
                   ` (2 preceding siblings ...)
  2025-12-09 10:00 ` [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug " Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:17   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 6/8] tools/rtla: Consolidate -e/--event " Costa Shulyupin
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -d/--duration.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/src/common.c        | 8 +++++++-
 tools/tracing/rtla/src/osnoise_hist.c  | 8 +-------
 tools/tracing/rtla/src/osnoise_top.c   | 8 +-------
 tools/tracing/rtla/src/timerlat_hist.c | 8 +-------
 tools/tracing/rtla/src/timerlat_top.c  | 8 +-------
 5 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index 5bf79a9bb152..e6ff011d2cd2 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -59,11 +59,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 		{"cpus",                required_argument,      0, 'c'},
 		{"cgroup",              optional_argument,      0, 'C'},
 		{"debug",               no_argument,            0, 'D'},
+		{"duration",            required_argument,      0, 'd'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "c:C::D", long_options, NULL);
+	c = getopt_long(argc, argv, "c:C::Dd:", long_options, NULL);
 	opterr = 1;
 
 	switch (c) {
@@ -79,6 +80,11 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 	case 'D':
 		config_debug = 1;
 		break;
+	case 'd':
+		common->duration = parse_seconds_duration(optarg);
+		if (!common->duration)
+			fatal("Invalid -d duration");
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 6902486fb144..1b79bfefc214 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -491,7 +491,6 @@ static struct common_params
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"entries",		required_argument,	0, 'E'},
-			{"duration",		required_argument,	0, 'd'},
 			{"house-keeping",	required_argument,		0, 'H'},
 			{"help",		no_argument,		0, 'h'},
 			{"period",		required_argument,	0, 'p'},
@@ -518,7 +517,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -544,11 +543,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'd':
-			params->common.duration = parse_seconds_duration(optarg);
-			if (!params->common.duration)
-				fatal("Invalid -D duration");
-			break;
 		case 'e':
 			tevent = trace_event_alloc(optarg);
 			if (!tevent)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 4a61fd50b990..619c5bcf8f35 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
 			{"house-keeping",	required_argument,	0, 'H'},
 			{"help",		no_argument,		0, 'h'},
@@ -370,7 +369,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -390,11 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 				trace_output = "osnoise_trace.txt";
 
 			break;
-		case 'd':
-			params->common.duration = parse_seconds_duration(optarg);
-			if (!params->common.duration)
-				fatal("Invalid -d duration");
-			break;
 		case 'e':
 			tevent = trace_event_alloc(optarg);
 			if (!tevent)
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 97d20e272583..0a7e5dcce121 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -798,7 +798,6 @@ static struct common_params
 			{"auto",		required_argument,	0, 'a'},
 			{"bucket-size",		required_argument,	0, 'b'},
 			{"entries",		required_argument,	0, 'E'},
-			{"duration",		required_argument,	0, 'd'},
 			{"house-keeping",	required_argument,	0, 'H'},
 			{"help",		no_argument,		0, 'h'},
 			{"irq",			required_argument,	0, 'i'},
@@ -834,7 +833,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:d:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:b:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -863,11 +862,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'd':
-			params->common.duration = parse_seconds_duration(optarg);
-			if (!params->common.duration)
-				fatal("Invalid -D duration");
-			break;
 		case 'e':
 			tevent = trace_event_alloc(optarg);
 			if (!tevent)
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 96bca67d419f..4340fbf3f879 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
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"duration",		required_argument,	0, 'd'},
 			{"event",		required_argument,	0, 'e'},
 			{"help",		no_argument,		0, 'h'},
 			{"house-keeping",	required_argument,	0, 'H'},
@@ -598,7 +597,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -635,11 +634,6 @@ static struct common_params
 			/* set aa_only to avoid parsing the trace */
 			params->common.aa_only = 1;
 			break;
-		case 'd':
-			params->common.duration = parse_seconds_duration(optarg);
-			if (!params->common.duration)
-				fatal("Invalid -d duration");
-			break;
 		case 'e':
 			tevent = trace_event_alloc(optarg);
 			if (!tevent)
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 6/8] tools/rtla: Consolidate -e/--event option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
                   ` (3 preceding siblings ...)
  2025-12-09 10:00 ` [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration " Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:18   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority " Costa Shulyupin
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -e/--event.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/src/common.c        | 13 ++++++++++++-
 tools/tracing/rtla/src/osnoise_hist.c  | 14 +-------------
 tools/tracing/rtla/src/osnoise_top.c   | 14 +-------------
 tools/tracing/rtla/src/timerlat_hist.c | 14 +-------------
 tools/tracing/rtla/src/timerlat_top.c  | 13 +------------
 5 files changed, 16 insertions(+), 52 deletions(-)

diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index e6ff011d2cd2..684ff49f0a4c 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -52,6 +52,7 @@ static void set_signals(struct common_params *params)
  */
 int common_parse_options(int argc, char **argv, struct common_params *common)
 {
+	struct trace_events *tevent;
 	int saved_state = optind;
 	int c;
 
@@ -60,11 +61,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 		{"cgroup",              optional_argument,      0, 'C'},
 		{"debug",               no_argument,            0, 'D'},
 		{"duration",            required_argument,      0, 'd'},
+		{"event",               required_argument,      0, 'e'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "c:C::Dd:", long_options, NULL);
+	c = getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL);
 	opterr = 1;
 
 	switch (c) {
@@ -85,6 +87,15 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
 		if (!common->duration)
 			fatal("Invalid -d duration");
 		break;
+	case 'e':
+		tevent = trace_event_alloc(optarg);
+		if (!tevent)
+			fatal("Error alloc trace event");
+
+		if (common->events)
+			tevent->next = common->events;
+		common->events = tevent;
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 1b79bfefc214..c4013f50e803 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -469,7 +469,6 @@ static struct common_params
 *osnoise_hist_parse_args(int argc, char *argv[])
 {
 	struct osnoise_params *params;
-	struct trace_events *tevent;
 	int retval;
 	int c;
 	char *trace_output = NULL;
@@ -499,7 +498,6 @@ static struct common_params
 			{"stop",		required_argument,	0, 's'},
 			{"stop-total",		required_argument,	0, 'S'},
 			{"trace",		optional_argument,	0, 't'},
-			{"event",		required_argument,	0, 'e'},
 			{"threshold",		required_argument,	0, 'T'},
 			{"no-header",		no_argument,		0, '0'},
 			{"no-summary",		no_argument,		0, '1'},
@@ -517,7 +515,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -543,16 +541,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'e':
-			tevent = trace_event_alloc(optarg);
-			if (!tevent)
-				fatal("Error alloc trace event");
-
-			if (params->common.events)
-				tevent->next = params->common.events;
-
-			params->common.events = tevent;
-			break;
 		case 'E':
 			params->common.hist.entries = get_llong_from_str(optarg);
 			if (params->common.hist.entries < 10 ||
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 619c5bcf8f35..846d25ee4885 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -322,7 +322,6 @@ static void osnoise_top_usage(struct osnoise_params *params)
 struct common_params *osnoise_top_parse_args(int argc, char **argv)
 {
 	struct osnoise_params *params;
-	struct trace_events *tevent;
 	int retval;
 	int c;
 	char *trace_output = NULL;
@@ -346,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'},
-			{"event",		required_argument,	0, 'e'},
 			{"house-keeping",	required_argument,	0, 'H'},
 			{"help",		no_argument,		0, 'h'},
 			{"period",		required_argument,	0, 'p'},
@@ -369,7 +367,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:hH:p:P:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -388,16 +386,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			if (!trace_output)
 				trace_output = "osnoise_trace.txt";
 
-			break;
-		case 'e':
-			tevent = trace_event_alloc(optarg);
-			if (!tevent)
-				fatal("Error alloc trace event");
-
-			if (params->common.events)
-				tevent->next = params->common.events;
-			params->common.events = tevent;
-
 			break;
 		case 'h':
 		case '?':
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 0a7e5dcce121..4744f84a452e 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -766,7 +766,6 @@ static struct common_params
 *timerlat_hist_parse_args(int argc, char *argv[])
 {
 	struct timerlat_params *params;
-	struct trace_events *tevent;
 	int auto_thresh;
 	int retval;
 	int c;
@@ -810,7 +809,6 @@ static struct common_params
 			{"user-threads",	no_argument,		0, 'u'},
 			{"kernel-threads",	no_argument,		0, 'k'},
 			{"user-load",		no_argument,		0, 'U'},
-			{"event",		required_argument,	0, 'e'},
 			{"no-irq",		no_argument,		0, '0'},
 			{"no-thread",		no_argument,		0, '1'},
 			{"no-header",		no_argument,		0, '2'},
@@ -833,7 +831,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -862,16 +860,6 @@ static struct common_params
 			    params->common.hist.bucket_size >= 1000000)
 				fatal("Bucket size needs to be > 0 and <= 1000000");
 			break;
-		case 'e':
-			tevent = trace_event_alloc(optarg);
-			if (!tevent)
-				fatal("Error alloc trace event");
-
-			if (params->common.events)
-				tevent->next = params->common.events;
-
-			params->common.events = tevent;
-			break;
 		case 'E':
 			params->common.hist.entries = get_llong_from_str(optarg);
 			if (params->common.hist.entries < 10 ||
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 4340fbf3f879..b77e5b6550a1 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -538,7 +538,6 @@ static struct common_params
 *timerlat_top_parse_args(int argc, char **argv)
 {
 	struct timerlat_params *params;
-	struct trace_events *tevent;
 	long long auto_thresh;
 	int retval;
 	int c;
@@ -566,7 +565,6 @@ static struct common_params
 	while (1) {
 		static struct option long_options[] = {
 			{"auto",		required_argument,	0, 'a'},
-			{"event",		required_argument,	0, 'e'},
 			{"help",		no_argument,		0, 'h'},
 			{"house-keeping",	required_argument,	0, 'H'},
 			{"irq",			required_argument,	0, 'i'},
@@ -597,7 +595,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -634,15 +632,6 @@ static struct common_params
 			/* set aa_only to avoid parsing the trace */
 			params->common.aa_only = 1;
 			break;
-		case 'e':
-			tevent = trace_event_alloc(optarg);
-			if (!tevent)
-				fatal("Error alloc trace event");
-
-			if (params->common.events)
-				tevent->next = params->common.events;
-			params->common.events = tevent;
-			break;
 		case 'h':
 		case '?':
 			timerlat_top_usage();
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
                   ` (4 preceding siblings ...)
  2025-12-09 10:00 ` [PATCH v2 6/8] tools/rtla: Consolidate -e/--event " Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:18   ` Wander Lairson Costa
  2025-12-09 10:00 ` [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping " Costa Shulyupin
  2025-12-16 16:16 ` [PATCH v2 1/8] tools/rtla: Add common_parse_options() Wander Lairson Costa
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

Each rtla tool duplicates parsing of -P/--priority.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.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 684ff49f0a4c..e042b2d9dbf5 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -62,11 +62,12 @@ 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'},
+		{"priority",            required_argument,      0, 'P'},
 		{0, 0, 0, 0}
 	};
 
 	opterr = 0;
-	c = getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL);
+	c = getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL);
 	opterr = 1;
 
 	switch (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 'P':
+		if (parse_prio(optarg, &common->sched_param) == -1)
+			fatal("Invalid -P priority");
+		common->set_sched = 1;
+		break;
 	default:
 		optind = saved_state;
 		return 0;
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index c4013f50e803..6ed5f5594960 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -493,7 +493,6 @@ static struct common_params
 			{"house-keeping",	required_argument,		0, 'H'},
 			{"help",		no_argument,		0, 'h'},
 			{"period",		required_argument,	0, 'p'},
-			{"priority",		required_argument,	0, 'P'},
 			{"runtime",		required_argument,	0, 'r'},
 			{"stop",		required_argument,	0, 's'},
 			{"stop-total",		required_argument,	0, 'S'},
@@ -515,7 +514,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
+		c = getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -562,12 +561,6 @@ static struct common_params
 			if (params->period > 10000000)
 				fatal("Period longer than 10 s");
 			break;
-		case 'P':
-			retval = parse_prio(optarg, &params->common.sched_param);
-			if (retval == -1)
-				fatal("Invalid -P priority");
-			params->common.set_sched = 1;
-			break;
 		case 'r':
 			params->runtime = get_llong_from_str(optarg);
 			if (params->runtime < 100)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 846d25ee4885..d2dfad960440 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -348,7 +348,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			{"house-keeping",	required_argument,	0, 'H'},
 			{"help",		no_argument,		0, 'h'},
 			{"period",		required_argument,	0, 'p'},
-			{"priority",		required_argument,	0, 'P'},
 			{"quiet",		no_argument,		0, 'q'},
 			{"runtime",		required_argument,	0, 'r'},
 			{"stop",		required_argument,	0, 's'},
@@ -367,7 +366,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:hH:p:P:qr:s:S:t::T:0:1:2:3:",
+		c = getopt_long(argc, argv, "a:hH:p:qr:s:S:t::T:0:1:2:3:",
 				 long_options, NULL);
 
 		/* Detect the end of the options. */
@@ -402,12 +401,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
 			if (params->period > 10000000)
 				fatal("Period longer than 10 s");
 			break;
-		case 'P':
-			retval = parse_prio(optarg, &params->common.sched_param);
-			if (retval == -1)
-				fatal("Invalid -P priority");
-			params->common.set_sched = 1;
-			break;
 		case 'q':
 			params->common.quiet = 1;
 			break;
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 4744f84a452e..e7ba083b5eb4 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -802,7 +802,6 @@ static struct common_params
 			{"irq",			required_argument,	0, 'i'},
 			{"nano",		no_argument,		0, 'n'},
 			{"period",		required_argument,	0, 'p'},
-			{"priority",		required_argument,	0, 'P'},
 			{"stack",		required_argument,	0, 's'},
 			{"thread",		required_argument,	0, 'T'},
 			{"trace",		optional_argument,	0, 't'},
@@ -831,7 +830,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
+		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -890,12 +889,6 @@ static struct common_params
 			if (params->timerlat_period_us > 1000000)
 				fatal("Period longer than 1 s");
 			break;
-		case 'P':
-			retval = parse_prio(optarg, &params->common.sched_param);
-			if (retval == -1)
-				fatal("Invalid -P priority");
-			params->common.set_sched = 1;
-			break;
 		case 's':
 			params->print_stack = 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 b77e5b6550a1..8250bea4b2fd 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -570,7 +570,6 @@ static struct common_params
 			{"irq",			required_argument,	0, 'i'},
 			{"nano",		no_argument,		0, 'n'},
 			{"period",		required_argument,	0, 'p'},
-			{"priority",		required_argument,	0, 'P'},
 			{"quiet",		no_argument,		0, 'q'},
 			{"stack",		required_argument,	0, 's'},
 			{"thread",		required_argument,	0, 'T'},
@@ -595,7 +594,7 @@ static struct common_params
 		if (common_parse_options(argc, argv, &params->common))
 			continue;
 
-		c = getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
+		c = getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:",
 				 long_options, NULL);
 
 		/* detect the end of the options. */
@@ -656,12 +655,6 @@ static struct common_params
 			if (params->timerlat_period_us > 1000000)
 				fatal("Period longer than 1 s");
 			break;
-		case 'P':
-			retval = parse_prio(optarg, &params->common.sched_param);
-			if (retval == -1)
-				fatal("Invalid -P priority");
-			params->common.set_sched = 1;
-			break;
 		case 'q':
 			params->common.quiet = 1;
 			break;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping option parsing
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
                   ` (5 preceding siblings ...)
  2025-12-09 10:00 ` [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority " Costa Shulyupin
@ 2025-12-09 10:00 ` Costa Shulyupin
  2025-12-16 16:18   ` Wander Lairson Costa
  2025-12-16 16:16 ` [PATCH v2 1/8] tools/rtla: Add common_parse_options() Wander Lairson Costa
  7 siblings, 1 reply; 17+ messages in thread
From: Costa Shulyupin @ 2025-12-09 10:00 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Costa Shulyupin, Crystal Wood,
	Wander Lairson Costa, John Kacur, Ivan Pravdin,
	linux-trace-kernel, linux-kernel

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@redhat.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 e042b2d9dbf5..8e90bb4a76f9 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);
 	opterr = 1;
 
 	switch (c) {
@@ -97,6 +98,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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 1/8] tools/rtla: Add common_parse_options()
  2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
                   ` (6 preceding siblings ...)
  2025-12-09 10:00 ` [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping " Costa Shulyupin
@ 2025-12-16 16:16 ` Wander Lairson Costa
  7 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:16 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:40PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of many common options. This creates
> maintenance overhead and risks inconsistencies when updating these
> options.
> 
> Add common_parse_options() to centralize parsing of options used across
> all tools.
> 
> Common options to be migrated in future patches.
> 
> Changes since v1:
> - restore opterr
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/src/common.c        | 35 ++++++++++++++++++++++++++
>  tools/tracing/rtla/src/common.h        |  1 +
>  tools/tracing/rtla/src/osnoise_hist.c  |  3 +++
>  tools/tracing/rtla/src/osnoise_top.c   |  3 +++
>  tools/tracing/rtla/src/timerlat_hist.c |  3 +++
>  tools/tracing/rtla/src/timerlat_top.c  |  3 +++
>  6 files changed, 48 insertions(+)
> 
> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index b197037fc58b..a78f9883521e 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -5,6 +5,7 @@
>  #include <signal.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> +#include <getopt.h>
>  #include "common.h"
>  
>  struct trace_instance *trace_inst;
> @@ -37,6 +38,40 @@ static void set_signals(struct common_params *params)
>  	}
>  }
>  
> +/*
> + * common_parse_options - parse common command line options
> + *
> + * @argc: argument count
> + * @argv: argument vector
> + * @common: common parameters structure
> + *
> + * Parse command line options that are common to all rtla tools.
> + *
> + * Returns: non zero if a common option was parsed, or 0
> + * if the option should be handled by tool-specific parsing.
> + */
> +int common_parse_options(int argc, char **argv, struct common_params *common)
> +{
> +	int saved_state = optind;
> +	int c;
> +
> +	static struct option long_options[] = {
> +		{0, 0, 0, 0}
> +	};
> +
> +	opterr = 0;
> +	c = getopt_long(argc, argv, "", long_options, NULL);
> +	opterr = 1;
> +
> +	switch (c) {
> +	default:
> +		optind = saved_state;
> +		return 0;
> +	}
> +
> +	return c;
> +}
> +
>  /*
>   * common_apply_config - apply common configs to the initialized tool
>   */
> diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/common.h
> index 9ec2b7632c37..1066d777a823 100644
> --- a/tools/tracing/rtla/src/common.h
> +++ b/tools/tracing/rtla/src/common.h
> @@ -153,6 +153,7 @@ struct osnoise_tool *osnoise_init_tool(char *tool_name);
>  struct osnoise_tool *osnoise_init_trace_tool(const char *tracer);
>  bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record);
>  
> +int common_parse_options(int argc, char **argv, struct common_params *common);
>  int common_apply_config(struct osnoise_tool *tool, struct common_params *params);
>  int top_main_loop(struct osnoise_tool *tool);
>  int hist_main_loop(struct osnoise_tool *tool);
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index ff8c231e47c4..35f4a068af95 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -518,6 +518,9 @@ static struct common_params
>  			{0, 0, 0, 0}
>  		};
>  
> +		if (common_parse_options(argc, argv, &params->common))
> +			continue;
> +
>  		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 04c699bdd736..550731c7addd 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -370,6 +370,9 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			{0, 0, 0, 0}
>  		};
>  
> +		if (common_parse_options(argc, argv, &params->common))
> +			continue;
> +
>  		c = getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 1fb471a787b7..ffcfcabb9964 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -834,6 +834,9 @@ static struct common_params
>  			{0, 0, 0, 0}
>  		};
>  
> +		if (common_parse_options(argc, argv, &params->common))
> +			continue;
> +
>  		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 29c2c1f717ed..d18d48671ccd 100644
> --- a/tools/tracing/rtla/src/timerlat_top.c
> +++ b/tools/tracing/rtla/src/timerlat_top.c
> @@ -598,6 +598,9 @@ static struct common_params
>  			{0, 0, 0, 0}
>  		};
>  
> +		if (common_parse_options(argc, argv, &params->common))
> +			continue;
> +
>  		c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing
  2025-12-09 10:00 ` [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
@ 2025-12-16 16:16   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:16 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:41PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -c/--cpus.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.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 a78f9883521e..e5aa8c30cd7d 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -56,14 +56,20 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  	int c;
>  
>  	static struct option long_options[] = {
> +		{"cpus",                required_argument,      0, 'c'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (c) {
> +	case 'c':
> +		if (parse_cpu_set(optarg, &common->monitored_cpus))
> +			fatal("Invalid -c cpu list");
> +		common->cpus = optarg;
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index 35f4a068af95..9e721362989a 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -491,7 +491,6 @@ static struct common_params
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"entries",		required_argument,	0, 'E'},
> -			{"cpus",		required_argument,	0, 'c'},
>  			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
> @@ -521,7 +520,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -547,12 +546,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'c':
> -			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
> -			if (retval)
> -				fatal("Invalid -c cpu list");
> -			params->common.cpus = optarg;
> -			break;
>  		case 'C':
>  			params->common.cgroup = 1;
>  			params->common.cgroup_name = parse_optional_arg(argc, argv);
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 550731c7addd..73736cefd992 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cpus",		required_argument,	0, 'c'},
>  			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
> @@ -373,7 +372,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -392,12 +391,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			if (!trace_output)
>  				trace_output = "osnoise_trace.txt";
>  
> -			break;
> -		case 'c':
> -			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
> -			if (retval)
> -				fatal("Invalid -c cpu list");
> -			params->common.cpus = optarg;
>  			break;
>  		case 'C':
>  			params->common.cgroup = 1;
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index ffcfcabb9964..4ae77145adea 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -796,7 +796,6 @@ static struct common_params
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cpus",		required_argument,	0, 'c'},
>  			{"cgroup",		optional_argument,	0, 'C'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"debug",		no_argument,		0, 'D'},
> @@ -837,7 +836,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -859,12 +858,6 @@ static struct common_params
>  			if (!trace_output)
>  				trace_output = "timerlat_trace.txt";
>  
> -			break;
> -		case 'c':
> -			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
> -			if (retval)
> -				fatal("Invalid -c cpu list");
> -			params->common.cpus = optarg;
>  			break;
>  		case 'C':
>  			params->common.cgroup = 1;
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index d18d48671ccd..9774c26b27ff 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
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cpus",		required_argument,	0, 'c'},
>  			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
> @@ -601,7 +600,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -638,12 +637,6 @@ static struct common_params
>  			/* set aa_only to avoid parsing the trace */
>  			params->common.aa_only = 1;
>  			break;
> -		case 'c':
> -			retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
> -			if (retval)
> -				fatal("Invalid -c cpu list");
> -			params->common.cpus = optarg;
> -			break;
>  		case 'C':
>  			params->common.cgroup = 1;
>  			params->common.cgroup_name = optarg;
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup option parsing
  2025-12-09 10:00 ` [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup " Costa Shulyupin
@ 2025-12-16 16:17   ` Wander Lairson Costa
  2025-12-16 18:04     ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:17 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:42PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -C/--cgroup.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/src/common.c        | 7 ++++++-
>  tools/tracing/rtla/src/osnoise_hist.c  | 7 +------
>  tools/tracing/rtla/src/osnoise_top.c   | 7 +------
>  tools/tracing/rtla/src/timerlat_hist.c | 7 +------
>  tools/tracing/rtla/src/timerlat_top.c  | 7 +------
>  5 files changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index e5aa8c30cd7d..33428fa77f9f 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -57,11 +57,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  
>  	static struct option long_options[] = {
>  		{"cpus",                required_argument,      0, 'c'},
> +		{"cgroup",              optional_argument,      0, 'C'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "c:", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:C::", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (c) {
> @@ -70,6 +71,10 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  			fatal("Invalid -c cpu list");
>  		common->cpus = optarg;
>  		break;
> +	case 'C':
> +		common->cgroup = 1;
> +		common->cgroup_name = parse_optional_arg(argc, argv);
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index 9e721362989a..5cbe5e1f1b07 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -491,7 +491,6 @@ static struct common_params
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"entries",		required_argument,	0, 'E'},
> -			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"house-keeping",	required_argument,		0, 'H'},
> @@ -520,7 +519,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -546,10 +545,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'C':
> -			params->common.cgroup = 1;
> -			params->common.cgroup_name = parse_optional_arg(argc, argv);
> -			break;
>  		case 'D':
>  			config_debug = 1;
>  			break;
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 73736cefd992..35db5b73c0d7 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
> @@ -372,7 +371,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -391,10 +390,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			if (!trace_output)
>  				trace_output = "osnoise_trace.txt";
>  
> -			break;
> -		case 'C':
> -			params->common.cgroup = 1;
> -			params->common.cgroup_name = parse_optional_arg(argc, argv);
>  			break;
>  		case 'D':
>  			config_debug = 1;
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 4ae77145adea..9ecab2bb0f1e 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -796,7 +796,6 @@ static struct common_params
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cgroup",		optional_argument,	0, 'C'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"entries",		required_argument,	0, 'E'},
> @@ -836,7 +835,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -858,10 +857,6 @@ static struct common_params
>  			if (!trace_output)
>  				trace_output = "timerlat_trace.txt";
>  
> -			break;
> -		case 'C':
> -			params->common.cgroup = 1;
> -			params->common.cgroup_name = parse_optional_arg(argc, argv);
>  			break;
>  		case 'b':
>  			params->common.hist.bucket_size = get_llong_from_str(optarg);
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 9774c26b27ff..6329c3a489aa 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
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"cgroup",		optional_argument,	0, 'C'},
>  			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
> @@ -600,7 +599,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -637,10 +636,6 @@ static struct common_params
>  			/* set aa_only to avoid parsing the trace */
>  			params->common.aa_only = 1;
>  			break;
> -		case 'C':
> -			params->common.cgroup = 1;
> -			params->common.cgroup_name = optarg;
> -			break;
>  		case 'D':
>  			config_debug = 1;
>  			break;
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug option parsing
  2025-12-09 10:00 ` [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug " Costa Shulyupin
@ 2025-12-16 16:17   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:17 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:43PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -D/--debug.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/src/common.c        | 6 +++++-
>  tools/tracing/rtla/src/osnoise_hist.c  | 6 +-----
>  tools/tracing/rtla/src/osnoise_top.c   | 6 +-----
>  tools/tracing/rtla/src/timerlat_hist.c | 6 +-----
>  tools/tracing/rtla/src/timerlat_top.c  | 6 +-----
>  5 files changed, 9 insertions(+), 21 deletions(-)
> 
> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index 33428fa77f9f..5bf79a9bb152 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -58,11 +58,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  	static struct option long_options[] = {
>  		{"cpus",                required_argument,      0, 'c'},
>  		{"cgroup",              optional_argument,      0, 'C'},
> +		{"debug",               no_argument,            0, 'D'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "c:C::", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:C::D", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (c) {
> @@ -75,6 +76,9 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  		common->cgroup = 1;
>  		common->cgroup_name = parse_optional_arg(argc, argv);
>  		break;
> +	case 'D':
> +		config_debug = 1;
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index 5cbe5e1f1b07..6902486fb144 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -491,7 +491,6 @@ static struct common_params
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"entries",		required_argument,	0, 'E'},
> -			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"house-keeping",	required_argument,		0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
> @@ -519,7 +518,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -545,9 +544,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'D':
> -			config_debug = 1;
> -			break;
>  		case 'd':
>  			params->common.duration = parse_seconds_duration(optarg);
>  			if (!params->common.duration)
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 35db5b73c0d7..4a61fd50b990 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
>  			{"house-keeping",	required_argument,	0, 'H'},
> @@ -371,7 +370,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -390,9 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			if (!trace_output)
>  				trace_output = "osnoise_trace.txt";
>  
> -			break;
> -		case 'D':
> -			config_debug = 1;
>  			break;
>  		case 'd':
>  			params->common.duration = parse_seconds_duration(optarg);
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 9ecab2bb0f1e..97d20e272583 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
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
> -			{"debug",		no_argument,		0, 'D'},
>  			{"entries",		required_argument,	0, 'E'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"house-keeping",	required_argument,	0, 'H'},
> @@ -835,7 +834,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:b:d:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -864,9 +863,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'D':
> -			config_debug = 1;
> -			break;
>  		case 'd':
>  			params->common.duration = parse_seconds_duration(optarg);
>  			if (!params->common.duration)
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 6329c3a489aa..96bca67d419f 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
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"debug",		no_argument,		0, 'D'},
>  			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
>  			{"help",		no_argument,		0, 'h'},
> @@ -599,7 +598,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -636,9 +635,6 @@ static struct common_params
>  			/* set aa_only to avoid parsing the trace */
>  			params->common.aa_only = 1;
>  			break;
> -		case 'D':
> -			config_debug = 1;
> -			break;
>  		case 'd':
>  			params->common.duration = parse_seconds_duration(optarg);
>  			if (!params->common.duration)
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration option parsing
  2025-12-09 10:00 ` [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration " Costa Shulyupin
@ 2025-12-16 16:17   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:17 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:44PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -d/--duration.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/src/common.c        | 8 +++++++-
>  tools/tracing/rtla/src/osnoise_hist.c  | 8 +-------
>  tools/tracing/rtla/src/osnoise_top.c   | 8 +-------
>  tools/tracing/rtla/src/timerlat_hist.c | 8 +-------
>  tools/tracing/rtla/src/timerlat_top.c  | 8 +-------
>  5 files changed, 11 insertions(+), 29 deletions(-)
> 
> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index 5bf79a9bb152..e6ff011d2cd2 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -59,11 +59,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  		{"cpus",                required_argument,      0, 'c'},
>  		{"cgroup",              optional_argument,      0, 'C'},
>  		{"debug",               no_argument,            0, 'D'},
> +		{"duration",            required_argument,      0, 'd'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "c:C::D", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:C::Dd:", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (c) {
> @@ -79,6 +80,11 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  	case 'D':
>  		config_debug = 1;
>  		break;
> +	case 'd':
> +		common->duration = parse_seconds_duration(optarg);
> +		if (!common->duration)
> +			fatal("Invalid -d duration");
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index 6902486fb144..1b79bfefc214 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -491,7 +491,6 @@ static struct common_params
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"entries",		required_argument,	0, 'E'},
> -			{"duration",		required_argument,	0, 'd'},
>  			{"house-keeping",	required_argument,		0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"period",		required_argument,	0, 'p'},
> @@ -518,7 +517,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -544,11 +543,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'd':
> -			params->common.duration = parse_seconds_duration(optarg);
> -			if (!params->common.duration)
> -				fatal("Invalid -D duration");
> -			break;
>  		case 'e':
>  			tevent = trace_event_alloc(optarg);
>  			if (!tevent)
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 4a61fd50b990..619c5bcf8f35 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
>  			{"house-keeping",	required_argument,	0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
> @@ -370,7 +369,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -390,11 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  				trace_output = "osnoise_trace.txt";
>  
>  			break;
> -		case 'd':
> -			params->common.duration = parse_seconds_duration(optarg);
> -			if (!params->common.duration)
> -				fatal("Invalid -d duration");
> -			break;
>  		case 'e':
>  			tevent = trace_event_alloc(optarg);
>  			if (!tevent)
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 97d20e272583..0a7e5dcce121 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -798,7 +798,6 @@ static struct common_params
>  			{"auto",		required_argument,	0, 'a'},
>  			{"bucket-size",		required_argument,	0, 'b'},
>  			{"entries",		required_argument,	0, 'E'},
> -			{"duration",		required_argument,	0, 'd'},
>  			{"house-keeping",	required_argument,	0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"irq",			required_argument,	0, 'i'},
> @@ -834,7 +833,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:d:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:b:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -863,11 +862,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'd':
> -			params->common.duration = parse_seconds_duration(optarg);
> -			if (!params->common.duration)
> -				fatal("Invalid -D duration");
> -			break;
>  		case 'e':
>  			tevent = trace_event_alloc(optarg);
>  			if (!tevent)
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 96bca67d419f..4340fbf3f879 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
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"duration",		required_argument,	0, 'd'},
>  			{"event",		required_argument,	0, 'e'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"house-keeping",	required_argument,	0, 'H'},
> @@ -598,7 +597,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -635,11 +634,6 @@ static struct common_params
>  			/* set aa_only to avoid parsing the trace */
>  			params->common.aa_only = 1;
>  			break;
> -		case 'd':
> -			params->common.duration = parse_seconds_duration(optarg);
> -			if (!params->common.duration)
> -				fatal("Invalid -d duration");
> -			break;
>  		case 'e':
>  			tevent = trace_event_alloc(optarg);
>  			if (!tevent)
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 6/8] tools/rtla: Consolidate -e/--event option parsing
  2025-12-09 10:00 ` [PATCH v2 6/8] tools/rtla: Consolidate -e/--event " Costa Shulyupin
@ 2025-12-16 16:18   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:18 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:45PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -e/--event.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/src/common.c        | 13 ++++++++++++-
>  tools/tracing/rtla/src/osnoise_hist.c  | 14 +-------------
>  tools/tracing/rtla/src/osnoise_top.c   | 14 +-------------
>  tools/tracing/rtla/src/timerlat_hist.c | 14 +-------------
>  tools/tracing/rtla/src/timerlat_top.c  | 13 +------------
>  5 files changed, 16 insertions(+), 52 deletions(-)
> 
> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index e6ff011d2cd2..684ff49f0a4c 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -52,6 +52,7 @@ static void set_signals(struct common_params *params)
>   */
>  int common_parse_options(int argc, char **argv, struct common_params *common)
>  {
> +	struct trace_events *tevent;
>  	int saved_state = optind;
>  	int c;
>  
> @@ -60,11 +61,12 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  		{"cgroup",              optional_argument,      0, 'C'},
>  		{"debug",               no_argument,            0, 'D'},
>  		{"duration",            required_argument,      0, 'd'},
> +		{"event",               required_argument,      0, 'e'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "c:C::Dd:", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (c) {
> @@ -85,6 +87,15 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
>  		if (!common->duration)
>  			fatal("Invalid -d duration");
>  		break;
> +	case 'e':
> +		tevent = trace_event_alloc(optarg);
> +		if (!tevent)
> +			fatal("Error alloc trace event");
> +
> +		if (common->events)
> +			tevent->next = common->events;
> +		common->events = tevent;
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index 1b79bfefc214..c4013f50e803 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -469,7 +469,6 @@ static struct common_params
>  *osnoise_hist_parse_args(int argc, char *argv[])
>  {
>  	struct osnoise_params *params;
> -	struct trace_events *tevent;
>  	int retval;
>  	int c;
>  	char *trace_output = NULL;
> @@ -499,7 +498,6 @@ static struct common_params
>  			{"stop",		required_argument,	0, 's'},
>  			{"stop-total",		required_argument,	0, 'S'},
>  			{"trace",		optional_argument,	0, 't'},
> -			{"event",		required_argument,	0, 'e'},
>  			{"threshold",		required_argument,	0, 'T'},
>  			{"no-header",		no_argument,		0, '0'},
>  			{"no-summary",		no_argument,		0, '1'},
> @@ -517,7 +515,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -543,16 +541,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'e':
> -			tevent = trace_event_alloc(optarg);
> -			if (!tevent)
> -				fatal("Error alloc trace event");
> -
> -			if (params->common.events)
> -				tevent->next = params->common.events;
> -
> -			params->common.events = tevent;
> -			break;
>  		case 'E':
>  			params->common.hist.entries = get_llong_from_str(optarg);
>  			if (params->common.hist.entries < 10 ||
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 619c5bcf8f35..846d25ee4885 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -322,7 +322,6 @@ static void osnoise_top_usage(struct osnoise_params *params)
>  struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  {
>  	struct osnoise_params *params;
> -	struct trace_events *tevent;
>  	int retval;
>  	int c;
>  	char *trace_output = NULL;
> @@ -346,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'},
> -			{"event",		required_argument,	0, 'e'},
>  			{"house-keeping",	required_argument,	0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"period",		required_argument,	0, 'p'},
> @@ -369,7 +367,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:e:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:hH:p:P:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -388,16 +386,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			if (!trace_output)
>  				trace_output = "osnoise_trace.txt";
>  
> -			break;
> -		case 'e':
> -			tevent = trace_event_alloc(optarg);
> -			if (!tevent)
> -				fatal("Error alloc trace event");
> -
> -			if (params->common.events)
> -				tevent->next = params->common.events;
> -			params->common.events = tevent;
> -
>  			break;
>  		case 'h':
>  		case '?':
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 0a7e5dcce121..4744f84a452e 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -766,7 +766,6 @@ static struct common_params
>  *timerlat_hist_parse_args(int argc, char *argv[])
>  {
>  	struct timerlat_params *params;
> -	struct trace_events *tevent;
>  	int auto_thresh;
>  	int retval;
>  	int c;
> @@ -810,7 +809,6 @@ static struct common_params
>  			{"user-threads",	no_argument,		0, 'u'},
>  			{"kernel-threads",	no_argument,		0, 'k'},
>  			{"user-load",		no_argument,		0, 'U'},
> -			{"event",		required_argument,	0, 'e'},
>  			{"no-irq",		no_argument,		0, '0'},
>  			{"no-thread",		no_argument,		0, '1'},
>  			{"no-header",		no_argument,		0, '2'},
> @@ -833,7 +831,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -862,16 +860,6 @@ static struct common_params
>  			    params->common.hist.bucket_size >= 1000000)
>  				fatal("Bucket size needs to be > 0 and <= 1000000");
>  			break;
> -		case 'e':
> -			tevent = trace_event_alloc(optarg);
> -			if (!tevent)
> -				fatal("Error alloc trace event");
> -
> -			if (params->common.events)
> -				tevent->next = params->common.events;
> -
> -			params->common.events = tevent;
> -			break;
>  		case 'E':
>  			params->common.hist.entries = get_llong_from_str(optarg);
>  			if (params->common.hist.entries < 10 ||
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 4340fbf3f879..b77e5b6550a1 100644
> --- a/tools/tracing/rtla/src/timerlat_top.c
> +++ b/tools/tracing/rtla/src/timerlat_top.c
> @@ -538,7 +538,6 @@ static struct common_params
>  *timerlat_top_parse_args(int argc, char **argv)
>  {
>  	struct timerlat_params *params;
> -	struct trace_events *tevent;
>  	long long auto_thresh;
>  	int retval;
>  	int c;
> @@ -566,7 +565,6 @@ static struct common_params
>  	while (1) {
>  		static struct option long_options[] = {
>  			{"auto",		required_argument,	0, 'a'},
> -			{"event",		required_argument,	0, 'e'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"house-keeping",	required_argument,	0, 'H'},
>  			{"irq",			required_argument,	0, 'i'},
> @@ -597,7 +595,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -634,15 +632,6 @@ static struct common_params
>  			/* set aa_only to avoid parsing the trace */
>  			params->common.aa_only = 1;
>  			break;
> -		case 'e':
> -			tevent = trace_event_alloc(optarg);
> -			if (!tevent)
> -				fatal("Error alloc trace event");
> -
> -			if (params->common.events)
> -				tevent->next = params->common.events;
> -			params->common.events = tevent;
> -			break;
>  		case 'h':
>  		case '?':
>  			timerlat_top_usage();
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority option parsing
  2025-12-09 10:00 ` [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority " Costa Shulyupin
@ 2025-12-16 16:18   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:18 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:46PM +0200, Costa Shulyupin wrote:
> Each rtla tool duplicates parsing of -P/--priority.
> 
> Migrate the option parsing from individual tools to the
> common_parse_options().
> 
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.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 684ff49f0a4c..e042b2d9dbf5 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
> @@ -62,11 +62,12 @@ 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'},
> +		{"priority",            required_argument,      0, 'P'},
>  		{0, 0, 0, 0}
>  	};
>  
>  	opterr = 0;
> -	c = getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL);
> +	c = getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL);
>  	opterr = 1;
>  
>  	switch (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 'P':
> +		if (parse_prio(optarg, &common->sched_param) == -1)
> +			fatal("Invalid -P priority");
> +		common->set_sched = 1;
> +		break;
>  	default:
>  		optind = saved_state;
>  		return 0;
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index c4013f50e803..6ed5f5594960 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -493,7 +493,6 @@ static struct common_params
>  			{"house-keeping",	required_argument,		0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"period",		required_argument,	0, 'p'},
> -			{"priority",		required_argument,	0, 'P'},
>  			{"runtime",		required_argument,	0, 'r'},
>  			{"stop",		required_argument,	0, 's'},
>  			{"stop-total",		required_argument,	0, 'S'},
> @@ -515,7 +514,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:",
> +		c = getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -562,12 +561,6 @@ static struct common_params
>  			if (params->period > 10000000)
>  				fatal("Period longer than 10 s");
>  			break;
> -		case 'P':
> -			retval = parse_prio(optarg, &params->common.sched_param);
> -			if (retval == -1)
> -				fatal("Invalid -P priority");
> -			params->common.set_sched = 1;
> -			break;
>  		case 'r':
>  			params->runtime = get_llong_from_str(optarg);
>  			if (params->runtime < 100)
> diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
> index 846d25ee4885..d2dfad960440 100644
> --- a/tools/tracing/rtla/src/osnoise_top.c
> +++ b/tools/tracing/rtla/src/osnoise_top.c
> @@ -348,7 +348,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			{"house-keeping",	required_argument,	0, 'H'},
>  			{"help",		no_argument,		0, 'h'},
>  			{"period",		required_argument,	0, 'p'},
> -			{"priority",		required_argument,	0, 'P'},
>  			{"quiet",		no_argument,		0, 'q'},
>  			{"runtime",		required_argument,	0, 'r'},
>  			{"stop",		required_argument,	0, 's'},
> @@ -367,7 +366,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:hH:p:P:qr:s:S:t::T:0:1:2:3:",
> +		c = getopt_long(argc, argv, "a:hH:p:qr:s:S:t::T:0:1:2:3:",
>  				 long_options, NULL);
>  
>  		/* Detect the end of the options. */
> @@ -402,12 +401,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
>  			if (params->period > 10000000)
>  				fatal("Period longer than 10 s");
>  			break;
> -		case 'P':
> -			retval = parse_prio(optarg, &params->common.sched_param);
> -			if (retval == -1)
> -				fatal("Invalid -P priority");
> -			params->common.set_sched = 1;
> -			break;
>  		case 'q':
>  			params->common.quiet = 1;
>  			break;
> diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
> index 4744f84a452e..e7ba083b5eb4 100644
> --- a/tools/tracing/rtla/src/timerlat_hist.c
> +++ b/tools/tracing/rtla/src/timerlat_hist.c
> @@ -802,7 +802,6 @@ static struct common_params
>  			{"irq",			required_argument,	0, 'i'},
>  			{"nano",		no_argument,		0, 'n'},
>  			{"period",		required_argument,	0, 'p'},
> -			{"priority",		required_argument,	0, 'P'},
>  			{"stack",		required_argument,	0, 's'},
>  			{"thread",		required_argument,	0, 'T'},
>  			{"trace",		optional_argument,	0, 't'},
> @@ -831,7 +830,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1\2:\3:",
> +		c = getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -890,12 +889,6 @@ static struct common_params
>  			if (params->timerlat_period_us > 1000000)
>  				fatal("Period longer than 1 s");
>  			break;
> -		case 'P':
> -			retval = parse_prio(optarg, &params->common.sched_param);
> -			if (retval == -1)
> -				fatal("Invalid -P priority");
> -			params->common.set_sched = 1;
> -			break;
>  		case 's':
>  			params->print_stack = 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 b77e5b6550a1..8250bea4b2fd 100644
> --- a/tools/tracing/rtla/src/timerlat_top.c
> +++ b/tools/tracing/rtla/src/timerlat_top.c
> @@ -570,7 +570,6 @@ static struct common_params
>  			{"irq",			required_argument,	0, 'i'},
>  			{"nano",		no_argument,		0, 'n'},
>  			{"period",		required_argument,	0, 'p'},
> -			{"priority",		required_argument,	0, 'P'},
>  			{"quiet",		no_argument,		0, 'q'},
>  			{"stack",		required_argument,	0, 's'},
>  			{"thread",		required_argument,	0, 'T'},
> @@ -595,7 +594,7 @@ static struct common_params
>  		if (common_parse_options(argc, argv, &params->common))
>  			continue;
>  
> -		c = getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:",
> +		c = getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:",
>  				 long_options, NULL);
>  
>  		/* detect the end of the options. */
> @@ -656,12 +655,6 @@ static struct common_params
>  			if (params->timerlat_period_us > 1000000)
>  				fatal("Period longer than 1 s");
>  			break;
> -		case 'P':
> -			retval = parse_prio(optarg, &params->common.sched_param);
> -			if (retval == -1)
> -				fatal("Invalid -P priority");
> -			params->common.set_sched = 1;
> -			break;
>  		case 'q':
>  			params->common.quiet = 1;
>  			break;
> -- 
> 2.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping option parsing
  2025-12-09 10:00 ` [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping " Costa Shulyupin
@ 2025-12-16 16:18   ` Wander Lairson Costa
  0 siblings, 0 replies; 17+ messages in thread
From: Wander Lairson Costa @ 2025-12-16 16:18 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, Dec 09, 2025 at 12:00:47PM +0200, Costa Shulyupin wrote:
> 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@redhat.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 e042b2d9dbf5..8e90bb4a76f9 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);
>  	opterr = 1;
>  
>  	switch (c) {
> @@ -97,6 +98,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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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, &params->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.52.0
> 

Reviewed-by: Wander Lairson Costa <wander@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup option parsing
  2025-12-16 16:17   ` Wander Lairson Costa
@ 2025-12-16 18:04     ` Steven Rostedt
  0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2025-12-16 18:04 UTC (permalink / raw)
  To: Wander Lairson Costa
  Cc: Costa Shulyupin, Tomas Glozar, Crystal Wood, John Kacur,
	Ivan Pravdin, linux-trace-kernel, linux-kernel

On Tue, 16 Dec 2025 13:17:00 -0300
Wander Lairson Costa <wander@redhat.com> wrote:

> >  			break;
> > -- 
> > 2.52.0
> >   
> 
> Reviewed-by: Wander Lairson Costa <wander@redhat.com>

Please trim your replies. It's very annoying to scroll down several pages
just to find a reviewed-by tag.

-- Steve

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-12-16 18:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 10:00 [PATCH v2 1/8] tools/rtla: Add common_parse_options() Costa Shulyupin
2025-12-09 10:00 ` [PATCH v2 2/8] tools/rtla: Consolidate -c/--cpus option parsing Costa Shulyupin
2025-12-16 16:16   ` Wander Lairson Costa
2025-12-09 10:00 ` [PATCH v2 3/8] tools/rtla: Consolidate -C/--cgroup " Costa Shulyupin
2025-12-16 16:17   ` Wander Lairson Costa
2025-12-16 18:04     ` Steven Rostedt
2025-12-09 10:00 ` [PATCH v2 4/8] tools/rtla: Consolidate -D/--debug " Costa Shulyupin
2025-12-16 16:17   ` Wander Lairson Costa
2025-12-09 10:00 ` [PATCH v2 5/8] tools/rtla: Consolidate -d/--duration " Costa Shulyupin
2025-12-16 16:17   ` Wander Lairson Costa
2025-12-09 10:00 ` [PATCH v2 6/8] tools/rtla: Consolidate -e/--event " Costa Shulyupin
2025-12-16 16:18   ` Wander Lairson Costa
2025-12-09 10:00 ` [PATCH v2 7/8] tools/rtla: Consolidate -P/--priority " Costa Shulyupin
2025-12-16 16:18   ` Wander Lairson Costa
2025-12-09 10:00 ` [PATCH v2 8/8] tools/rtla: Consolidate -H/--house-keeping " Costa Shulyupin
2025-12-16 16:18   ` Wander Lairson Costa
2025-12-16 16:16 ` [PATCH v2 1/8] tools/rtla: Add common_parse_options() Wander Lairson Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox