summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosta Shulyupin <costa.shul@redhat.com>2025-10-11 11:27:38 +0300
committerTomas Glozar <tglozar@redhat.com>2025-11-21 10:30:27 +0100
commit49c15794198ff03a4fa844f894f7e5d4bdbffcfc (patch)
tree943398653cedd238aec03211d9eeb27ed379220e
parent92b5b55e5e8eeed9094dc68cdbb1afe31dd0ff37 (diff)
tools/rtla: Replace osnoise_hist_usage("...") with fatal("...")
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> Reviewed-by: Tomas Glozar <tglozar@redhat.com> Link: https://lore.kernel.org/r/20251011082738.173670-6-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
-rw-r--r--tools/tracing/rtla/src/osnoise_hist.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index d30a9a03b764..1d841a3056bc 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -407,7 +407,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;
@@ -453,18 +453,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);
}
@@ -547,12 +541,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");
break;
case 'c':
retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
if (retval)
- osnoise_hist_usage("\nInvalid -c cpu list\n");
+ fatal("Invalid -c cpu list");
params->common.cpus = optarg;
break;
case 'C':
@@ -571,7 +565,7 @@ 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");
break;
case 'e':
tevent = trace_event_alloc(optarg);
@@ -587,11 +581,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");
break;
case 'h':
case '?':
- osnoise_hist_usage(NULL);
+ osnoise_hist_usage();
break;
case 'H':
params->common.hk_cpus = 1;
@@ -602,18 +596,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");
break;
case 'P':
retval = parse_prio(optarg, &params->common.sched_param);
if (retval == -1)
- osnoise_hist_usage("Invalid -P priority");
+ fatal("Invalid -P priority");
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");
break;
case 's':
params->common.stop_us = get_llong_from_str(optarg);
@@ -653,7 +647,7 @@ static struct common_params
if (retval)
fatal("Error adding trigger %s", optarg);
} else {
- osnoise_hist_usage("--trigger requires a previous -e\n");
+ fatal("--trigger requires a previous -e");
}
break;
case '5': /* filter */
@@ -662,7 +656,7 @@ static struct common_params
if (retval)
fatal("Error adding filter %s", optarg);
} else {
- osnoise_hist_usage("--filter requires a previous -e\n");
+ fatal("--filter requires a previous -e");
}
break;
case '6':
@@ -684,7 +678,7 @@ static struct common_params
fatal("Invalid action %s", optarg);
break;
default:
- osnoise_hist_usage("Invalid option");
+ fatal("Invalid option");
}
}
@@ -695,7 +689,7 @@ static struct common_params
fatal("rtla needs root permission");
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");
return &params->common;
}