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_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>

authored by

Costa Shulyupin and committed by
Tomas Glozar
4e5e7210 8cbb25db

+11 -17
+11 -17
tools/tracing/rtla/src/timerlat_top.c
··· 474 474 /* 475 475 * timerlat_top_usage - prints timerlat top usage message 476 476 */ 477 - static void timerlat_top_usage(char *usage) 477 + static void timerlat_top_usage(void) 478 478 { 479 479 int i; 480 480 ··· 522 522 NULL, 523 523 }; 524 524 525 - if (usage) 526 - fprintf(stderr, "%s\n", usage); 527 - 528 525 fprintf(stderr, "rtla timerlat top: a per-cpu summary of the timer latency (version %s)\n", 529 526 VERSION); 530 527 531 528 for (i = 0; msg[i]; i++) 532 529 fprintf(stderr, "%s\n", msg[i]); 533 - 534 - if (usage) 535 - exit(EXIT_FAILURE); 536 530 537 531 exit(EXIT_SUCCESS); 538 532 } ··· 637 643 case 'c': 638 644 retval = parse_cpu_set(optarg, &params->common.monitored_cpus); 639 645 if (retval) 640 - timerlat_top_usage("\nInvalid -c cpu list\n"); 646 + fatal("Invalid -c cpu list"); 641 647 params->common.cpus = optarg; 642 648 break; 643 649 case 'C': ··· 656 662 case 'd': 657 663 params->common.duration = parse_seconds_duration(optarg); 658 664 if (!params->common.duration) 659 - timerlat_top_usage("Invalid -d duration\n"); 665 + fatal("Invalid -d duration"); 660 666 break; 661 667 case 'e': 662 668 tevent = trace_event_alloc(optarg); ··· 669 675 break; 670 676 case 'h': 671 677 case '?': 672 - timerlat_top_usage(NULL); 678 + timerlat_top_usage(); 673 679 break; 674 680 case 'H': 675 681 params->common.hk_cpus = 1; ··· 689 695 case 'p': 690 696 params->timerlat_period_us = get_llong_from_str(optarg); 691 697 if (params->timerlat_period_us > 1000000) 692 - timerlat_top_usage("Period longer than 1 s\n"); 698 + fatal("Period longer than 1 s"); 693 699 break; 694 700 case 'P': 695 701 retval = parse_prio(optarg, &params->common.sched_param); 696 702 if (retval == -1) 697 - timerlat_top_usage("Invalid -P priority"); 703 + fatal("Invalid -P priority"); 698 704 params->common.set_sched = 1; 699 705 break; 700 706 case 'q': ··· 729 735 if (retval) 730 736 fatal("Error adding trigger %s", optarg); 731 737 } else { 732 - timerlat_top_usage("--trigger requires a previous -e\n"); 738 + fatal("--trigger requires a previous -e"); 733 739 } 734 740 break; 735 741 case '1': /* filter */ ··· 738 744 if (retval) 739 745 fatal("Error adding filter %s", optarg); 740 746 } else { 741 - timerlat_top_usage("--filter requires a previous -e\n"); 747 + fatal("--filter requires a previous -e"); 742 748 } 743 749 break; 744 750 case '2': /* dma-latency */ ··· 774 780 fatal("Invalid action %s", optarg); 775 781 break; 776 782 default: 777 - timerlat_top_usage("Invalid option"); 783 + fatal("Invalid option"); 778 784 } 779 785 } 780 786 ··· 791 797 params->no_aa = 1; 792 798 793 799 if (params->no_aa && params->common.aa_only) 794 - timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!"); 800 + fatal("--no-aa and --aa-only are mutually exclusive!"); 795 801 796 802 if (params->common.kernel_workload && params->common.user_workload) 797 - timerlat_top_usage("--kernel-threads and --user-threads are mutually exclusive!"); 803 + fatal("--kernel-threads and --user-threads are mutually exclusive!"); 798 804 799 805 /* 800 806 * If auto-analysis or trace output is enabled, switch from BPF mode to