Skip to content

Commit 8f4264e

Browse files
makelinuxlenticularis39
authored andcommitted
tools/rtla: Replace timerlat_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 timerlat_hist_usage("...\n") with fatal("...") on errors. Remove the already unused 'usage' argument from timerlat_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-4-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
1 parent 4e5e721 commit 8f4264e

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

tools/tracing/rtla/src/timerlat_hist.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
694694
/*
695695
* timerlat_hist_usage - prints timerlat top usage message
696696
*/
697-
static void timerlat_hist_usage(char *usage)
697+
static void timerlat_hist_usage(void)
698698
{
699699
int i;
700700

@@ -750,18 +750,12 @@ static void timerlat_hist_usage(char *usage)
750750
NULL,
751751
};
752752

753-
if (usage)
754-
fprintf(stderr, "%s\n", usage);
755-
756753
fprintf(stderr, "rtla timerlat hist: a per-cpu histogram of the timer latency (version %s)\n",
757754
VERSION);
758755

759756
for (i = 0; msg[i]; i++)
760757
fprintf(stderr, "%s\n", msg[i]);
761758

762-
if (usage)
763-
exit(EXIT_FAILURE);
764-
765759
exit(EXIT_SUCCESS);
766760
}
767761

@@ -865,7 +859,7 @@ static struct common_params
865859
case 'c':
866860
retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
867861
if (retval)
868-
timerlat_hist_usage("\nInvalid -c cpu list\n");
862+
fatal("Invalid -c cpu list");
869863
params->common.cpus = optarg;
870864
break;
871865
case 'C':
@@ -882,15 +876,15 @@ static struct common_params
882876
params->common.hist.bucket_size = get_llong_from_str(optarg);
883877
if (params->common.hist.bucket_size == 0 ||
884878
params->common.hist.bucket_size >= 1000000)
885-
timerlat_hist_usage("Bucket size needs to be > 0 and <= 1000000\n");
879+
fatal("Bucket size needs to be > 0 and <= 1000000");
886880
break;
887881
case 'D':
888882
config_debug = 1;
889883
break;
890884
case 'd':
891885
params->common.duration = parse_seconds_duration(optarg);
892886
if (!params->common.duration)
893-
timerlat_hist_usage("Invalid -D duration\n");
887+
fatal("Invalid -D duration");
894888
break;
895889
case 'e':
896890
tevent = trace_event_alloc(optarg);
@@ -906,11 +900,11 @@ static struct common_params
906900
params->common.hist.entries = get_llong_from_str(optarg);
907901
if (params->common.hist.entries < 10 ||
908902
params->common.hist.entries > 9999999)
909-
timerlat_hist_usage("Entries must be > 10 and < 9999999\n");
903+
fatal("Entries must be > 10 and < 9999999");
910904
break;
911905
case 'h':
912906
case '?':
913-
timerlat_hist_usage(NULL);
907+
timerlat_hist_usage();
914908
break;
915909
case 'H':
916910
params->common.hk_cpus = 1;
@@ -930,12 +924,12 @@ static struct common_params
930924
case 'p':
931925
params->timerlat_period_us = get_llong_from_str(optarg);
932926
if (params->timerlat_period_us > 1000000)
933-
timerlat_hist_usage("Period longer than 1 s\n");
927+
fatal("Period longer than 1 s");
934928
break;
935929
case 'P':
936930
retval = parse_prio(optarg, &params->common.sched_param);
937931
if (retval == -1)
938-
timerlat_hist_usage("Invalid -P priority");
932+
fatal("Invalid -P priority");
939933
params->common.set_sched = 1;
940934
break;
941935
case 's':
@@ -985,7 +979,7 @@ static struct common_params
985979
if (retval)
986980
fatal("Error adding trigger %s", optarg);
987981
} else {
988-
timerlat_hist_usage("--trigger requires a previous -e\n");
982+
fatal("--trigger requires a previous -e");
989983
}
990984
break;
991985
case '7': /* filter */
@@ -994,7 +988,7 @@ static struct common_params
994988
if (retval)
995989
fatal("Error adding filter %s", optarg);
996990
} else {
997-
timerlat_hist_usage("--filter requires a previous -e\n");
991+
fatal("--filter requires a previous -e");
998992
}
999993
break;
1000994
case '8':
@@ -1041,10 +1035,10 @@ static struct common_params
10411035
fatal("rtla needs root permission");
10421036

10431037
if (params->common.hist.no_irq && params->common.hist.no_thread)
1044-
timerlat_hist_usage("no-irq and no-thread set, there is nothing to do here");
1038+
fatal("no-irq and no-thread set, there is nothing to do here");
10451039

10461040
if (params->common.hist.no_index && !params->common.hist.with_zeros)
1047-
timerlat_hist_usage("no-index set with with-zeros is not set - it does not make sense");
1041+
fatal("no-index set with with-zeros is not set - it does not make sense");
10481042

10491043
/*
10501044
* Auto analysis only happens if stop tracing, thus:
@@ -1053,7 +1047,7 @@ static struct common_params
10531047
params->no_aa = 1;
10541048

10551049
if (params->common.kernel_workload && params->common.user_workload)
1056-
timerlat_hist_usage("--kernel-threads and --user-threads are mutually exclusive!");
1050+
fatal("--kernel-threads and --user-threads are mutually exclusive!");
10571051

10581052
/*
10591053
* If auto-analysis or trace output is enabled, switch from BPF mode to

0 commit comments

Comments
 (0)