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

authored by

Costa Shulyupin and committed by
Tomas Glozar
49c15794 92b5b55e

+13 -19
+13 -19
tools/tracing/rtla/src/osnoise_hist.c
··· 407 407 /* 408 408 * osnoise_hist_usage - prints osnoise hist usage message 409 409 */ 410 - static void osnoise_hist_usage(char *usage) 410 + static void osnoise_hist_usage(void) 411 411 { 412 412 int i; 413 413 ··· 453 453 NULL, 454 454 }; 455 455 456 - if (usage) 457 - fprintf(stderr, "%s\n", usage); 458 - 459 456 fprintf(stderr, "rtla osnoise hist: a per-cpu histogram of the OS noise (version %s)\n", 460 457 VERSION); 461 458 462 459 for (i = 0; msg[i]; i++) 463 460 fprintf(stderr, "%s\n", msg[i]); 464 - 465 - if (usage) 466 - exit(EXIT_FAILURE); 467 461 468 462 exit(EXIT_SUCCESS); 469 463 } ··· 541 547 params->common.hist.bucket_size = get_llong_from_str(optarg); 542 548 if (params->common.hist.bucket_size == 0 || 543 549 params->common.hist.bucket_size >= 1000000) 544 - osnoise_hist_usage("Bucket size needs to be > 0 and <= 1000000\n"); 550 + fatal("Bucket size needs to be > 0 and <= 1000000"); 545 551 break; 546 552 case 'c': 547 553 retval = parse_cpu_set(optarg, &params->common.monitored_cpus); 548 554 if (retval) 549 - osnoise_hist_usage("\nInvalid -c cpu list\n"); 555 + fatal("Invalid -c cpu list"); 550 556 params->common.cpus = optarg; 551 557 break; 552 558 case 'C': ··· 565 571 case 'd': 566 572 params->common.duration = parse_seconds_duration(optarg); 567 573 if (!params->common.duration) 568 - osnoise_hist_usage("Invalid -D duration\n"); 574 + fatal("Invalid -D duration"); 569 575 break; 570 576 case 'e': 571 577 tevent = trace_event_alloc(optarg); ··· 581 587 params->common.hist.entries = get_llong_from_str(optarg); 582 588 if (params->common.hist.entries < 10 || 583 589 params->common.hist.entries > 9999999) 584 - osnoise_hist_usage("Entries must be > 10 and < 9999999\n"); 590 + fatal("Entries must be > 10 and < 9999999"); 585 591 break; 586 592 case 'h': 587 593 case '?': 588 - osnoise_hist_usage(NULL); 594 + osnoise_hist_usage(); 589 595 break; 590 596 case 'H': 591 597 params->common.hk_cpus = 1; ··· 596 602 case 'p': 597 603 params->period = get_llong_from_str(optarg); 598 604 if (params->period > 10000000) 599 - osnoise_hist_usage("Period longer than 10 s\n"); 605 + fatal("Period longer than 10 s"); 600 606 break; 601 607 case 'P': 602 608 retval = parse_prio(optarg, &params->common.sched_param); 603 609 if (retval == -1) 604 - osnoise_hist_usage("Invalid -P priority"); 610 + fatal("Invalid -P priority"); 605 611 params->common.set_sched = 1; 606 612 break; 607 613 case 'r': 608 614 params->runtime = get_llong_from_str(optarg); 609 615 if (params->runtime < 100) 610 - osnoise_hist_usage("Runtime shorter than 100 us\n"); 616 + fatal("Runtime shorter than 100 us"); 611 617 break; 612 618 case 's': 613 619 params->common.stop_us = get_llong_from_str(optarg); ··· 647 653 if (retval) 648 654 fatal("Error adding trigger %s", optarg); 649 655 } else { 650 - osnoise_hist_usage("--trigger requires a previous -e\n"); 656 + fatal("--trigger requires a previous -e"); 651 657 } 652 658 break; 653 659 case '5': /* filter */ ··· 656 662 if (retval) 657 663 fatal("Error adding filter %s", optarg); 658 664 } else { 659 - osnoise_hist_usage("--filter requires a previous -e\n"); 665 + fatal("--filter requires a previous -e"); 660 666 } 661 667 break; 662 668 case '6': ··· 678 684 fatal("Invalid action %s", optarg); 679 685 break; 680 686 default: 681 - osnoise_hist_usage("Invalid option"); 687 + fatal("Invalid option"); 682 688 } 683 689 } 684 690 ··· 689 695 fatal("rtla needs root permission"); 690 696 691 697 if (params->common.hist.no_index && !params->common.hist.with_zeros) 692 - osnoise_hist_usage("no-index set and with-zeros not set - it does not make sense"); 698 + fatal("no-index set and with-zeros not set - it does not make sense"); 693 699 694 700 return &params->common; 695 701 }