From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>
Subject: [for-next][PATCH 11/16] tools/rtla: Replace osnoise_top_usage("...") with fatal("...")
Date: Thu, 20 Nov 2025 18:23:34 -0500 [thread overview]
Message-ID: <20251120232709.115021875@kernel.org> (raw)
In-Reply-To: 20251120232323.271532418@kernel.org
From: Costa Shulyupin <costa.shul@redhat.com>
A long time ago, when the usage help was short, it was a favor
to the user to show it on error. Now that the usage help has
become very long, it is too noisy to dump the complete help text
for each typo after the error message itself.
Replace osnoise_top_usage("...") with fatal("...") on errors.
Remove the already unused 'usage' argument from osnoise_top_usage().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
Reviewed-by: Tomas Glozar <tglozar@redhat.com>
Link: https://lore.kernel.org/r/20251011082738.173670-5-costa.shul@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/osnoise_top.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 487daac8908c..de8e26d7c68b 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -255,7 +255,7 @@ osnoise_print_stats(struct osnoise_tool *top)
/*
* osnoise_top_usage - prints osnoise top usage message
*/
-static void osnoise_top_usage(struct osnoise_params *params, char *usage)
+static void osnoise_top_usage(struct osnoise_params *params)
{
int i;
@@ -294,9 +294,6 @@ static void osnoise_top_usage(struct osnoise_params *params, char *usage)
NULL,
};
- if (usage)
- fprintf(stderr, "%s\n", usage);
-
if (params->mode == MODE_OSNOISE) {
fprintf(stderr,
"rtla osnoise top: a per-cpu summary of the OS noise (version %s)\n",
@@ -316,9 +313,6 @@ static void osnoise_top_usage(struct osnoise_params *params, char *usage)
for (i = 0; msg[i]; i++)
fprintf(stderr, "%s\n", msg[i]);
- if (usage)
- exit(EXIT_FAILURE);
-
exit(EXIT_SUCCESS);
}
@@ -398,7 +392,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
case 'c':
retval = parse_cpu_set(optarg, ¶ms->common.monitored_cpus);
if (retval)
- osnoise_top_usage(params, "\nInvalid -c cpu list\n");
+ fatal("Invalid -c cpu list");
params->common.cpus = optarg;
break;
case 'C':
@@ -417,7 +411,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
case 'd':
params->common.duration = parse_seconds_duration(optarg);
if (!params->common.duration)
- osnoise_top_usage(params, "Invalid -d duration\n");
+ fatal("Invalid -d duration");
break;
case 'e':
tevent = trace_event_alloc(optarg);
@@ -431,7 +425,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
break;
case 'h':
case '?':
- osnoise_top_usage(params, NULL);
+ osnoise_top_usage(params);
break;
case 'H':
params->common.hk_cpus = 1;
@@ -442,12 +436,12 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
case 'p':
params->period = get_llong_from_str(optarg);
if (params->period > 10000000)
- osnoise_top_usage(params, "Period longer than 10 s\n");
+ fatal("Period longer than 10 s");
break;
case 'P':
retval = parse_prio(optarg, ¶ms->common.sched_param);
if (retval == -1)
- osnoise_top_usage(params, "Invalid -P priority");
+ fatal("Invalid -P priority");
params->common.set_sched = 1;
break;
case 'q':
@@ -456,7 +450,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
case 'r':
params->runtime = get_llong_from_str(optarg);
if (params->runtime < 100)
- osnoise_top_usage(params, "Runtime shorter than 100 us\n");
+ fatal("Runtime shorter than 100 us");
break;
case 's':
params->common.stop_us = get_llong_from_str(optarg);
@@ -484,7 +478,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
if (retval)
fatal("Error adding trigger %s", optarg);
} else {
- osnoise_top_usage(params, "--trigger requires a previous -e\n");
+ fatal("--trigger requires a previous -e");
}
break;
case '1': /* filter */
@@ -493,7 +487,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
if (retval)
fatal("Error adding filter %s", optarg);
} else {
- osnoise_top_usage(params, "--filter requires a previous -e\n");
+ fatal("--filter requires a previous -e");
}
break;
case '2':
@@ -515,7 +509,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
fatal("Invalid action %s", optarg);
break;
default:
- osnoise_top_usage(params, "Invalid option");
+ fatal("Invalid option");
}
}
--
2.51.0
next prev parent reply other threads:[~2025-11-20 23:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 23:23 [for-next][PATCH 00/16] rtla: Updates for v6.19 Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 01/16] tools/rtla: Add for_each_monitored_cpu() helper Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 02/16] tools/rtla: Remove unused optional option_index Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 03/16] tools/rtla: Fix unassigned nr_cpus Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 04/16] rtla/timerlat_bpf: Stop tracing on user latency Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 05/16] tools/rtla: Fix --on-threshold always triggering Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 06/16] rtla/tests: Extend action tests to 5s Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 07/16] rtla/tests: Fix osnoise test calling timerlat Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 08/16] tools/rtla: Add fatal() and replace error handling pattern Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 09/16] tools/rtla: Replace timerlat_top_usage("...") with fatal("...") Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 10/16] tools/rtla: Replace timerlat_hist_usage("...") " Steven Rostedt
2025-11-20 23:23 ` Steven Rostedt [this message]
2025-11-20 23:23 ` [for-next][PATCH 12/16] tools/rtla: Replace osnoise_hist_usage("...") " Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 13/16] rtla: Fix -C/--cgroup interface Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 14/16] rtla: Fix -a overriding -t argument Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 15/16] rtla/tests: Dont rely on matching ^1ALL Steven Rostedt
2025-11-20 23:23 ` [for-next][PATCH 16/16] rtla/timerlat: Exit top main loop on any non-zero wait_retval Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251120232709.115021875@kernel.org \
--to=rostedt@kernel.org \
--cc=costa.shul@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglozar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.