Skip to content

Commit 4e5e721

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

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ timerlat_print_stats(struct osnoise_tool *top)
474474
/*
475475
* timerlat_top_usage - prints timerlat top usage message
476476
*/
477-
static void timerlat_top_usage(char *usage)
477+
static void timerlat_top_usage(void)
478478
{
479479
int i;
480480

@@ -522,18 +522,12 @@ static void timerlat_top_usage(char *usage)
522522
NULL,
523523
};
524524

525-
if (usage)
526-
fprintf(stderr, "%s\n", usage);
527-
528525
fprintf(stderr, "rtla timerlat top: a per-cpu summary of the timer latency (version %s)\n",
529526
VERSION);
530527

531528
for (i = 0; msg[i]; i++)
532529
fprintf(stderr, "%s\n", msg[i]);
533530

534-
if (usage)
535-
exit(EXIT_FAILURE);
536-
537531
exit(EXIT_SUCCESS);
538532
}
539533

@@ -643,7 +637,7 @@ static struct common_params
643637
case 'c':
644638
retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
645639
if (retval)
646-
timerlat_top_usage("\nInvalid -c cpu list\n");
640+
fatal("Invalid -c cpu list");
647641
params->common.cpus = optarg;
648642
break;
649643
case 'C':
@@ -662,7 +656,7 @@ static struct common_params
662656
case 'd':
663657
params->common.duration = parse_seconds_duration(optarg);
664658
if (!params->common.duration)
665-
timerlat_top_usage("Invalid -d duration\n");
659+
fatal("Invalid -d duration");
666660
break;
667661
case 'e':
668662
tevent = trace_event_alloc(optarg);
@@ -675,7 +669,7 @@ static struct common_params
675669
break;
676670
case 'h':
677671
case '?':
678-
timerlat_top_usage(NULL);
672+
timerlat_top_usage();
679673
break;
680674
case 'H':
681675
params->common.hk_cpus = 1;
@@ -695,12 +689,12 @@ static struct common_params
695689
case 'p':
696690
params->timerlat_period_us = get_llong_from_str(optarg);
697691
if (params->timerlat_period_us > 1000000)
698-
timerlat_top_usage("Period longer than 1 s\n");
692+
fatal("Period longer than 1 s");
699693
break;
700694
case 'P':
701695
retval = parse_prio(optarg, &params->common.sched_param);
702696
if (retval == -1)
703-
timerlat_top_usage("Invalid -P priority");
697+
fatal("Invalid -P priority");
704698
params->common.set_sched = 1;
705699
break;
706700
case 'q':
@@ -735,7 +729,7 @@ static struct common_params
735729
if (retval)
736730
fatal("Error adding trigger %s", optarg);
737731
} else {
738-
timerlat_top_usage("--trigger requires a previous -e\n");
732+
fatal("--trigger requires a previous -e");
739733
}
740734
break;
741735
case '1': /* filter */
@@ -744,7 +738,7 @@ static struct common_params
744738
if (retval)
745739
fatal("Error adding filter %s", optarg);
746740
} else {
747-
timerlat_top_usage("--filter requires a previous -e\n");
741+
fatal("--filter requires a previous -e");
748742
}
749743
break;
750744
case '2': /* dma-latency */
@@ -780,7 +774,7 @@ static struct common_params
780774
fatal("Invalid action %s", optarg);
781775
break;
782776
default:
783-
timerlat_top_usage("Invalid option");
777+
fatal("Invalid option");
784778
}
785779
}
786780

@@ -797,10 +791,10 @@ static struct common_params
797791
params->no_aa = 1;
798792

799793
if (params->no_aa && params->common.aa_only)
800-
timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!");
794+
fatal("--no-aa and --aa-only are mutually exclusive!");
801795

802796
if (params->common.kernel_workload && params->common.user_workload)
803-
timerlat_top_usage("--kernel-threads and --user-threads are mutually exclusive!");
797+
fatal("--kernel-threads and --user-threads are mutually exclusive!");
804798

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

0 commit comments

Comments
 (0)