Skip to content

Commit 92b5b55

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

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ osnoise_print_stats(struct osnoise_tool *top)
255255
/*
256256
* osnoise_top_usage - prints osnoise top usage message
257257
*/
258-
static void osnoise_top_usage(struct osnoise_params *params, char *usage)
258+
static void osnoise_top_usage(struct osnoise_params *params)
259259
{
260260
int i;
261261

@@ -294,9 +294,6 @@ static void osnoise_top_usage(struct osnoise_params *params, char *usage)
294294
NULL,
295295
};
296296

297-
if (usage)
298-
fprintf(stderr, "%s\n", usage);
299-
300297
if (params->mode == MODE_OSNOISE) {
301298
fprintf(stderr,
302299
"rtla osnoise top: a per-cpu summary of the OS noise (version %s)\n",
@@ -316,9 +313,6 @@ static void osnoise_top_usage(struct osnoise_params *params, char *usage)
316313
for (i = 0; msg[i]; i++)
317314
fprintf(stderr, "%s\n", msg[i]);
318315

319-
if (usage)
320-
exit(EXIT_FAILURE);
321-
322316
exit(EXIT_SUCCESS);
323317
}
324318

@@ -398,7 +392,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
398392
case 'c':
399393
retval = parse_cpu_set(optarg, &params->common.monitored_cpus);
400394
if (retval)
401-
osnoise_top_usage(params, "\nInvalid -c cpu list\n");
395+
fatal("Invalid -c cpu list");
402396
params->common.cpus = optarg;
403397
break;
404398
case 'C':
@@ -417,7 +411,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
417411
case 'd':
418412
params->common.duration = parse_seconds_duration(optarg);
419413
if (!params->common.duration)
420-
osnoise_top_usage(params, "Invalid -d duration\n");
414+
fatal("Invalid -d duration");
421415
break;
422416
case 'e':
423417
tevent = trace_event_alloc(optarg);
@@ -431,7 +425,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
431425
break;
432426
case 'h':
433427
case '?':
434-
osnoise_top_usage(params, NULL);
428+
osnoise_top_usage(params);
435429
break;
436430
case 'H':
437431
params->common.hk_cpus = 1;
@@ -442,12 +436,12 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
442436
case 'p':
443437
params->period = get_llong_from_str(optarg);
444438
if (params->period > 10000000)
445-
osnoise_top_usage(params, "Period longer than 10 s\n");
439+
fatal("Period longer than 10 s");
446440
break;
447441
case 'P':
448442
retval = parse_prio(optarg, &params->common.sched_param);
449443
if (retval == -1)
450-
osnoise_top_usage(params, "Invalid -P priority");
444+
fatal("Invalid -P priority");
451445
params->common.set_sched = 1;
452446
break;
453447
case 'q':
@@ -456,7 +450,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
456450
case 'r':
457451
params->runtime = get_llong_from_str(optarg);
458452
if (params->runtime < 100)
459-
osnoise_top_usage(params, "Runtime shorter than 100 us\n");
453+
fatal("Runtime shorter than 100 us");
460454
break;
461455
case 's':
462456
params->common.stop_us = get_llong_from_str(optarg);
@@ -484,7 +478,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
484478
if (retval)
485479
fatal("Error adding trigger %s", optarg);
486480
} else {
487-
osnoise_top_usage(params, "--trigger requires a previous -e\n");
481+
fatal("--trigger requires a previous -e");
488482
}
489483
break;
490484
case '1': /* filter */
@@ -493,7 +487,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
493487
if (retval)
494488
fatal("Error adding filter %s", optarg);
495489
} else {
496-
osnoise_top_usage(params, "--filter requires a previous -e\n");
490+
fatal("--filter requires a previous -e");
497491
}
498492
break;
499493
case '2':
@@ -515,7 +509,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
515509
fatal("Invalid action %s", optarg);
516510
break;
517511
default:
518-
osnoise_top_usage(params, "Invalid option");
512+
fatal("Invalid option");
519513
}
520514
}
521515

0 commit comments

Comments
 (0)