From: Costa Shulyupin <costa.shul@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Tomas Glozar <tglozar@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Crystal Wood <crwood@redhat.com>, John Kacur <jkacur@redhat.com>,
Jan Stancek <jstancek@redhat.com>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 4/5] tools/rtla: Replace osnoise_hist_usage("...") with fatal("...")
Date: Wed, 8 Oct 2025 22:59:04 +0300 [thread overview]
Message-ID: <20251008195905.333514-5-costa.shul@redhat.com> (raw)
In-Reply-To: <20251008195905.333514-1-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_hist_usage("...") with fatal("...") on errors.
Remove the already unused 'usage' argument from osnoise_hist_usage().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
tools/tracing/rtla/src/osnoise_hist.c | 34 +++++++++++----------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 43c323521f55..3c4d8e25fd55 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -421,7 +421,7 @@ osnoise_print_stats(struct osnoise_tool *tool)
/*
* osnoise_hist_usage - prints osnoise hist usage message
*/
-static void osnoise_hist_usage(char *usage)
+static void osnoise_hist_usage(void)
{
int i;
@@ -467,18 +467,12 @@ static void osnoise_hist_usage(char *usage)
NULL,
};
- if (usage)
- fprintf(stderr, "%s\n", usage);
-
fprintf(stderr, "rtla osnoise hist: a per-cpu histogram of the OS noise (version %s)\n",
VERSION);
for (i = 0; msg[i]; i++)
fprintf(stderr, "%s\n", msg[i]);
- if (usage)
- exit(EXIT_FAILURE);
-
exit(EXIT_SUCCESS);
}
@@ -564,12 +558,12 @@ static struct common_params
params->common.hist.bucket_size = get_llong_from_str(optarg);
if (params->common.hist.bucket_size == 0 ||
params->common.hist.bucket_size >= 1000000)
- osnoise_hist_usage("Bucket size needs to be > 0 and <= 1000000\n");
+ fatal("Bucket size needs to be > 0 and <= 1000000\n");
break;
case 'c':
retval = parse_cpu_set(optarg, ¶ms->common.monitored_cpus);
if (retval)
- osnoise_hist_usage("\nInvalid -c cpu list\n");
+ fatal("\nInvalid -c cpu list\n");
params->common.cpus = optarg;
break;
case 'C':
@@ -588,12 +582,12 @@ static struct common_params
case 'd':
params->common.duration = parse_seconds_duration(optarg);
if (!params->common.duration)
- osnoise_hist_usage("Invalid -D duration\n");
+ fatal("Invalid -D duration\n");
break;
case 'e':
tevent = trace_event_alloc(optarg);
if (!tevent)
- fatal("Error alloc trace event");
+ fatal("Error alloc trace event\n");
if (params->common.events)
tevent->next = params->common.events;
@@ -604,11 +598,11 @@ static struct common_params
params->common.hist.entries = get_llong_from_str(optarg);
if (params->common.hist.entries < 10 ||
params->common.hist.entries > 9999999)
- osnoise_hist_usage("Entries must be > 10 and < 9999999\n");
+ fatal("Entries must be > 10 and < 9999999\n");
break;
case 'h':
case '?':
- osnoise_hist_usage(NULL);
+ osnoise_hist_usage();
break;
case 'H':
params->common.hk_cpus = 1;
@@ -619,18 +613,18 @@ static struct common_params
case 'p':
params->period = get_llong_from_str(optarg);
if (params->period > 10000000)
- osnoise_hist_usage("Period longer than 10 s\n");
+ fatal("Period longer than 10 s\n");
break;
case 'P':
retval = parse_prio(optarg, ¶ms->common.sched_param);
if (retval == -1)
- osnoise_hist_usage("Invalid -P priority");
+ fatal("Invalid -P priority\n");
params->common.set_sched = 1;
break;
case 'r':
params->runtime = get_llong_from_str(optarg);
if (params->runtime < 100)
- osnoise_hist_usage("Runtime shorter than 100 us\n");
+ fatal("Runtime shorter than 100 us\n");
break;
case 's':
params->common.stop_us = get_llong_from_str(optarg);
@@ -670,7 +664,7 @@ static struct common_params
if (retval)
fatal("Error adding trigger %s\n", optarg);
} else {
- osnoise_hist_usage("--trigger requires a previous -e\n");
+ fatal("--trigger requires a previous -e\n");
}
break;
case '5': /* filter */
@@ -679,7 +673,7 @@ static struct common_params
if (retval)
fatal("Error adding filter %s\n", optarg);
} else {
- osnoise_hist_usage("--filter requires a previous -e\n");
+ fatal("--filter requires a previous -e\n");
}
break;
case '6':
@@ -701,7 +695,7 @@ static struct common_params
fatal("Invalid action %s\n", optarg);
break;
default:
- osnoise_hist_usage("Invalid option");
+ fatal("Invalid option\n");
}
}
@@ -712,7 +706,7 @@ static struct common_params
fatal("rtla needs root permission\n");
if (params->common.hist.no_index && !params->common.hist.with_zeros)
- osnoise_hist_usage("no-index set and with-zeros not set - it does not make sense");
+ fatal("no-index set and with-zeros not set - it does not make sense\n");
return ¶ms->common;
}
--
2.51.0
next prev parent reply other threads:[~2025-10-08 20:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 19:59 [PATCH v1 0/5] tools/rtla: Improve argument processing Costa Shulyupin
2025-10-08 19:59 ` [PATCH v1 1/5] tools/rtla: Add fatal() and replace error handling pattern Costa Shulyupin
2025-10-08 21:55 ` Crystal Wood
2025-10-10 7:20 ` Costa Shulyupin
2025-10-10 17:50 ` Crystal Wood
2025-10-08 19:59 ` [PATCH v1 2/5] tools/rtla: Replace timerlat_top_usage("...") with fatal("...") Costa Shulyupin
2025-10-08 19:59 ` [PATCH v1 3/5] tools/rtla: Replace timerlat_hist_usage("...") " Costa Shulyupin
2025-10-08 19:59 ` Costa Shulyupin [this message]
2025-10-08 19:59 ` [PATCH v1 5/5] tools/rtla: Replace osnoise_top_usage("...") " Costa Shulyupin
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=20251008195905.333514-5-costa.shul@redhat.com \
--to=costa.shul@redhat.com \
--cc=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=jstancek@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).