Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Costa Shulyupin and committed by
Tomas Glozar
8f4264e0 4e5e7210

+13 -19
+13 -19
tools/tracing/rtla/src/timerlat_hist.c
··· 694 694 /* 695 695 * timerlat_hist_usage - prints timerlat top usage message 696 696 */ 697 - static void timerlat_hist_usage(char *usage) 697 + static void timerlat_hist_usage(void) 698 698 { 699 699 int i; 700 700 ··· 750 750 NULL, 751 751 }; 752 752 753 - if (usage) 754 - fprintf(stderr, "%s\n", usage); 755 - 756 753 fprintf(stderr, "rtla timerlat hist: a per-cpu histogram of the timer latency (version %s)\n", 757 754 VERSION); 758 755 759 756 for (i = 0; msg[i]; i++) 760 757 fprintf(stderr, "%s\n", msg[i]); 761 - 762 - if (usage) 763 - exit(EXIT_FAILURE); 764 758 765 759 exit(EXIT_SUCCESS); 766 760 } ··· 859 865 case 'c': 860 866 retval = parse_cpu_set(optarg, &params->common.monitored_cpus); 861 867 if (retval) 862 - timerlat_hist_usage("\nInvalid -c cpu list\n"); 868 + fatal("Invalid -c cpu list"); 863 869 params->common.cpus = optarg; 864 870 break; 865 871 case 'C': ··· 876 882 params->common.hist.bucket_size = get_llong_from_str(optarg); 877 883 if (params->common.hist.bucket_size == 0 || 878 884 params->common.hist.bucket_size >= 1000000) 879 - timerlat_hist_usage("Bucket size needs to be > 0 and <= 1000000\n"); 885 + fatal("Bucket size needs to be > 0 and <= 1000000"); 880 886 break; 881 887 case 'D': 882 888 config_debug = 1; ··· 884 890 case 'd': 885 891 params->common.duration = parse_seconds_duration(optarg); 886 892 if (!params->common.duration) 887 - timerlat_hist_usage("Invalid -D duration\n"); 893 + fatal("Invalid -D duration"); 888 894 break; 889 895 case 'e': 890 896 tevent = trace_event_alloc(optarg); ··· 900 906 params->common.hist.entries = get_llong_from_str(optarg); 901 907 if (params->common.hist.entries < 10 || 902 908 params->common.hist.entries > 9999999) 903 - timerlat_hist_usage("Entries must be > 10 and < 9999999\n"); 909 + fatal("Entries must be > 10 and < 9999999"); 904 910 break; 905 911 case 'h': 906 912 case '?': 907 - timerlat_hist_usage(NULL); 913 + timerlat_hist_usage(); 908 914 break; 909 915 case 'H': 910 916 params->common.hk_cpus = 1; ··· 924 930 case 'p': 925 931 params->timerlat_period_us = get_llong_from_str(optarg); 926 932 if (params->timerlat_period_us > 1000000) 927 - timerlat_hist_usage("Period longer than 1 s\n"); 933 + fatal("Period longer than 1 s"); 928 934 break; 929 935 case 'P': 930 936 retval = parse_prio(optarg, &params->common.sched_param); 931 937 if (retval == -1) 932 - timerlat_hist_usage("Invalid -P priority"); 938 + fatal("Invalid -P priority"); 933 939 params->common.set_sched = 1; 934 940 break; 935 941 case 's': ··· 979 985 if (retval) 980 986 fatal("Error adding trigger %s", optarg); 981 987 } else { 982 - timerlat_hist_usage("--trigger requires a previous -e\n"); 988 + fatal("--trigger requires a previous -e"); 983 989 } 984 990 break; 985 991 case '7': /* filter */ ··· 988 994 if (retval) 989 995 fatal("Error adding filter %s", optarg); 990 996 } else { 991 - timerlat_hist_usage("--filter requires a previous -e\n"); 997 + fatal("--filter requires a previous -e"); 992 998 } 993 999 break; 994 1000 case '8': ··· 1035 1041 fatal("rtla needs root permission"); 1036 1042 1037 1043 if (params->common.hist.no_irq && params->common.hist.no_thread) 1038 - timerlat_hist_usage("no-irq and no-thread set, there is nothing to do here"); 1044 + fatal("no-irq and no-thread set, there is nothing to do here"); 1039 1045 1040 1046 if (params->common.hist.no_index && !params->common.hist.with_zeros) 1041 - timerlat_hist_usage("no-index set with with-zeros is not set - it does not make sense"); 1047 + fatal("no-index set with with-zeros is not set - it does not make sense"); 1042 1048 1043 1049 /* 1044 1050 * Auto analysis only happens if stop tracing, thus: ··· 1047 1053 params->no_aa = 1; 1048 1054 1049 1055 if (params->common.kernel_workload && params->common.user_workload) 1050 - timerlat_hist_usage("--kernel-threads and --user-threads are mutually exclusive!"); 1056 + fatal("--kernel-threads and --user-threads are mutually exclusive!"); 1051 1057 1052 1058 /* 1053 1059 * If auto-analysis or trace output is enabled, switch from BPF mode to