]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/rtla: Consolidate -H/--house-keeping option parsing
authorCosta Shulyupin <costa.shul@redhat.com>
Tue, 9 Dec 2025 10:00:47 +0000 (12:00 +0200)
committerTomas Glozar <tglozar@redhat.com>
Wed, 7 Jan 2026 14:57:17 +0000 (15:57 +0100)
Each rtla tool duplicates parsing of -H/--house-keeping.

Migrate the option parsing from individual tools to the
common_parse_options().

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
Link: https://lore.kernel.org/r/20251209100047.2692515-8-costa.shul@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
tools/tracing/rtla/src/common.c
tools/tracing/rtla/src/osnoise_hist.c
tools/tracing/rtla/src/osnoise_top.c
tools/tracing/rtla/src/timerlat_hist.c
tools/tracing/rtla/src/timerlat_top.c

index 90f1bbb7e18936cd6a075f46acf37d65e3f0f652..6f64c1fc1b621a25af073d5e3fdea05f6e1fb079 100644 (file)
@@ -63,12 +63,13 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
                {"debug",               no_argument,            0, 'D'},
                {"duration",            required_argument,      0, 'd'},
                {"event",               required_argument,      0, 'e'},
+               {"house-keeping",       required_argument,      0, 'H'},
                {"priority",            required_argument,      0, 'P'},
                {0, 0, 0, 0}
        };
 
        opterr = 0;
-       c = getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL);
+       c = getopt_long(argc, argv, "c:C::Dd:e:H:P:", long_options, NULL);
        opterr = 1;
 
        switch (c) {
@@ -98,6 +99,11 @@ int common_parse_options(int argc, char **argv, struct common_params *common)
                        tevent->next = common->events;
                common->events = tevent;
                break;
+       case 'H':
+               common->hk_cpus = 1;
+               if (parse_cpu_set(optarg, &common->hk_cpu_set))
+                       fatal("Error parsing house keeping CPUs");
+               break;
        case 'P':
                if (parse_prio(optarg, &common->sched_param) == -1)
                        fatal("Invalid -P priority");
index 6e66726766a1f4e0635f621103327f8644998b6c..705c73d5510224ae717ab7572e3ce57627f7952d 100644 (file)
@@ -484,7 +484,6 @@ static struct common_params
                        {"auto",                required_argument,      0, 'a'},
                        {"bucket-size",         required_argument,      0, 'b'},
                        {"entries",             required_argument,      0, 'E'},
-                       {"house-keeping",       required_argument,              0, 'H'},
                        {"help",                no_argument,            0, 'h'},
                        {"period",              required_argument,      0, 'p'},
                        {"runtime",             required_argument,      0, 'r'},
@@ -508,7 +507,7 @@ static struct common_params
                if (common_parse_options(argc, argv, &params->common))
                        continue;
 
-               c = getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:",
+               c = getopt_long(argc, argv, "a:b:E:hp:r:s:S:t::T:01234:5:6:7:",
                                 long_options, NULL);
 
                /* detect the end of the options. */
@@ -544,12 +543,6 @@ static struct common_params
                case '?':
                        osnoise_hist_usage();
                        break;
-               case 'H':
-                       params->common.hk_cpus = 1;
-                       retval = parse_cpu_set(optarg, &params->common.hk_cpu_set);
-                       if (retval)
-                               fatal("Error parsing house keeping CPUs");
-                       break;
                case 'p':
                        params->period = get_llong_from_str(optarg);
                        if (params->period > 10000000)
index 7ac992ec7439c3f1eaabc20f14f3582555211b24..d54d47947fb4404c04b82d396cb06091e05fefec 100644 (file)
@@ -338,7 +338,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
        while (1) {
                static struct option long_options[] = {
                        {"auto",                required_argument,      0, 'a'},
-                       {"house-keeping",       required_argument,      0, 'H'},
                        {"help",                no_argument,            0, 'h'},
                        {"period",              required_argument,      0, 'p'},
                        {"quiet",               no_argument,            0, 'q'},
@@ -359,7 +358,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
                if (common_parse_options(argc, argv, &params->common))
                        continue;
 
-               c = getopt_long(argc, argv, "a:hH:p:qr:s:S:t::T:0:1:2:3:",
+               c = getopt_long(argc, argv, "a:hp:qr:s:S:t::T:0:1:2:3:",
                                 long_options, NULL);
 
                /* Detect the end of the options. */
@@ -383,12 +382,6 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv)
                case '?':
                        osnoise_top_usage(params);
                        break;
-               case 'H':
-                       params->common.hk_cpus = 1;
-                       retval = parse_cpu_set(optarg, &params->common.hk_cpu_set);
-                       if (retval)
-                               fatal("Error parsing house keeping CPUs");
-                       break;
                case 'p':
                        params->period = get_llong_from_str(optarg);
                        if (params->period > 10000000)
index 99b416ccfc5b0b7e45ebacece049c09ae2c17969..4e8c38a61197c396ab9d19e599ceffe57573a153 100644 (file)
@@ -792,7 +792,6 @@ static struct common_params
                        {"auto",                required_argument,      0, 'a'},
                        {"bucket-size",         required_argument,      0, 'b'},
                        {"entries",             required_argument,      0, 'E'},
-                       {"house-keeping",       required_argument,      0, 'H'},
                        {"help",                no_argument,            0, 'h'},
                        {"irq",                 required_argument,      0, 'i'},
                        {"nano",                no_argument,            0, 'n'},
@@ -826,7 +825,7 @@ static struct common_params
                if (common_parse_options(argc, argv, &params->common))
                        continue;
 
-               c = getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
+               c = getopt_long(argc, argv, "a:b:E:hi:knp:s:t::T:uU0123456:7:8:9\1\2:\3:",
                                 long_options, NULL);
 
                /* detect the end of the options. */
@@ -865,12 +864,6 @@ static struct common_params
                case '?':
                        timerlat_hist_usage();
                        break;
-               case 'H':
-                       params->common.hk_cpus = 1;
-                       retval = parse_cpu_set(optarg, &params->common.hk_cpu_set);
-                       if (retval)
-                               fatal("Error parsing house keeping CPUs");
-                       break;
                case 'i':
                        params->common.stop_us = get_llong_from_str(optarg);
                        break;
index 027aad1b639f7432e6b8dcdc212ba77a8df662b8..f5a809344913060d0447505790ca0e997e751cbe 100644 (file)
@@ -561,7 +561,6 @@ static struct common_params
                static struct option long_options[] = {
                        {"auto",                required_argument,      0, 'a'},
                        {"help",                no_argument,            0, 'h'},
-                       {"house-keeping",       required_argument,      0, 'H'},
                        {"irq",                 required_argument,      0, 'i'},
                        {"nano",                no_argument,            0, 'n'},
                        {"period",              required_argument,      0, 'p'},
@@ -590,7 +589,7 @@ static struct common_params
                if (common_parse_options(argc, argv, &params->common))
                        continue;
 
-               c = getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:",
+               c = getopt_long(argc, argv, "a:hi:knp:qs:t::T:uU0:1:2:345:6:7:",
                                 long_options, NULL);
 
                /* detect the end of the options. */
@@ -631,12 +630,6 @@ static struct common_params
                case '?':
                        timerlat_top_usage();
                        break;
-               case 'H':
-                       params->common.hk_cpus = 1;
-                       retval = parse_cpu_set(optarg, &params->common.hk_cpu_set);
-                       if (retval)
-                               fatal("Error parsing house keeping CPUs");
-                       break;
                case 'i':
                        params->common.stop_us = get_llong_from_str(optarg);
                        break;