From 95290562e0d436739392748af4da346540c983b8 Mon Sep 17 00:00:00 2001 From: Szabina Korbai Date: Wed, 10 Sep 2025 09:12:45 +0100 Subject: [PATCH] cpumf: Implement zsh and bash autocompletion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add autocompletion script generation for the cpumf family of tools (chcpumf, lscpumf, lshwc, lspai, pai) Reviewed-by: Jan Höppner Reviewed-by: Steffen Eiden Signed-off-by: Szabina Korbai Signed-off-by: Steffen Eiden --- .gitignore | 11 ++++ cpumf/Makefile | 5 ++ cpumf/autocompletion_generator_host.c | 28 +++++++++ cpumf/chcpumf.c | 27 +-------- cpumf/chcpumf_cli.h | 40 +++++++++++++ cpumf/lscpumf.c | 31 +--------- cpumf/lscpumf_cli.h | 44 +++++++++++++++ cpumf/lshwc.c | 64 +-------------------- cpumf/lshwc_cli.h | 78 ++++++++++++++++++++++++++ cpumf/lspai.c | 66 +--------------------- cpumf/lspai_cli.h | 81 +++++++++++++++++++++++++++ cpumf/pai.c | 52 +---------------- cpumf/pai_cli.h | 65 +++++++++++++++++++++ 13 files changed, 365 insertions(+), 227 deletions(-) create mode 100644 cpumf/autocompletion_generator_host.c create mode 100644 cpumf/chcpumf_cli.h create mode 100644 cpumf/lscpumf_cli.h create mode 100644 cpumf/lshwc_cli.h create mode 100644 cpumf/lspai_cli.h create mode 100644 cpumf/pai_cli.h diff --git a/.gitignore b/.gitignore index 65b1d214..1a3151b6 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ compile_commands.json # **/.detect-openssl.dep.c *.debug +*/autocompletion_generator_host ap_tools/ap-check cmsfs-fuse/cmsfs-fuse cpacfstats/cpacfstats @@ -34,6 +35,16 @@ cpumf/lscpumf cpumf/lshwc cpumf/lspai cpumf/pai +cpumf/_chcpumf +cpumf/_lscpumf +cpumf/_lshwc +cpumf/_lspai +cpumf/_pai +cpumf/chcpumf.bash +cpumf/lscpumf.bash +cpumf/lshwc.bash +cpumf/lspai.bash +cpumf/pai.bash cpuplugd/cpuplugd dasdfmt/dasdfmt dasdinfo/dasdinfo diff --git a/cpumf/Makefile b/cpumf/Makefile index 0f9b5b36..6515b4fe 100644 --- a/cpumf/Makefile +++ b/cpumf/Makefile @@ -3,6 +3,11 @@ include ../common.mak BIN_FILES = lscpumf chcpumf lshwc pai lspai MAN_FILES = lscpumf.8 chcpumf.8 lshwc.8 pai.8 lspai.8 +zsh-completions := $(addprefix _,$(BIN_FILES)) +bash-completions := $(addsuffix .bash,$(BIN_FILES)) + +include ../common_autocomp.mak + all: $(BIN_FILES) libs = $(rootdir)/libcpumf/libcpumf.a $(rootdir)/libutil/libutil.a diff --git a/cpumf/autocompletion_generator_host.c b/cpumf/autocompletion_generator_host.c new file mode 100644 index 00000000..b7c48aaf --- /dev/null +++ b/cpumf/autocompletion_generator_host.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +/* + * Autocompletion generation - for cpumf family of tools + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#include "lib/util_autocomp.h" + +#include "chcpumf_cli.h" +#include "lscpumf_cli.h" +#include "lshwc_cli.h" +#include "lspai_cli.h" +#include "pai_cli.h" + +int main(void) +{ + generate_autocomp(chcpumf_opt_vec, "chcpumf"); + generate_autocomp(lscpumf_opt_vec, "lscpumf"); + generate_autocomp(lshwc_opt_vec, "lshwc"); + generate_autocomp(lspai_opt_vec, "lspai"); + generate_autocomp(pai_opt_vec, "pai"); + + return 0; +} diff --git a/cpumf/chcpumf.c b/cpumf/chcpumf.c index 62ab3e3c..c3791d7b 100644 --- a/cpumf/chcpumf.c +++ b/cpumf/chcpumf.c @@ -21,32 +21,11 @@ #include "lib/util_path.h" #include "lib/util_prg.h" +#include "chcpumf_cli.h" + static unsigned int verbose; static unsigned long min_sdb, max_sdb; -static struct util_opt opt_vec[] = { - UTIL_OPT_SECTION("OPTIONS"), - { - .option = { "min", required_argument, NULL, 'm' }, - .argument = "num_sdb", - .desc = "Specifies the initial size of the sampling buffer.\n" - "A sample-data-block (SDB) consumes about 4 kilobytes.", - }, - { - .option = { "max", required_argument, NULL, 'x' }, - .argument = "num_sdb", - .desc = "Specifies the maximum size of the sampling buffer.\n" - "A sample-data-block (SDB) consumes about 4 kilobytes.", - }, - { - .option = { "verbose", no_argument, NULL, 'V' }, - .desc = "Verbose, display new sample-data-block values.", - }, - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; - static const struct util_prg prg = { .desc = "Change CPU Measurement facility charactertics", .copyright_vec = { @@ -162,7 +141,7 @@ int main(int argc, char **argv) unsigned long my_min, my_max; util_prg_init(&prg); - util_opt_init(opt_vec, NULL); + util_opt_init(chcpumf_opt_vec, NULL); parse_args(argc, argv); if (geteuid()) diff --git a/cpumf/chcpumf_cli.h b/cpumf/chcpumf_cli.h new file mode 100644 index 00000000..4f485c67 --- /dev/null +++ b/cpumf/chcpumf_cli.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Command line utilities - for chcpumf + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef CHCPUMF_CLI_H +#define CHCPUMF_CLI_H + +#include "lib/util_fmt.h" +#include "lib/util_opt.h" + +static struct util_opt chcpumf_opt_vec[] = { + UTIL_OPT_SECTION("OPTIONS"), + { + .option = { "min", required_argument, NULL, 'm' }, + .argument = "num_sdb", + .desc = "Specifies the initial size of the sampling buffer.\n" + "A sample-data-block (SDB) consumes about 4 kilobytes.", + }, + { + .option = { "max", required_argument, NULL, 'x' }, + .argument = "num_sdb", + .desc = "Specifies the maximum size of the sampling buffer.\n" + "A sample-data-block (SDB) consumes about 4 kilobytes.", + }, + { + .option = { "verbose", no_argument, NULL, 'V' }, + .desc = "Verbose, display new sample-data-block values.", + }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif diff --git a/cpumf/lscpumf.c b/cpumf/lscpumf.c index a93576b9..28cb4cf0 100644 --- a/cpumf/lscpumf.c +++ b/cpumf/lscpumf.c @@ -30,6 +30,8 @@ #include "lib/libcpumf.h" +#include "lscpumf_cli.h" + #define ACTION_NONE 0 #define ACTION_INFO 1 #define ACTION_CNT 2 @@ -46,33 +48,6 @@ static bool actions[ACTION_SAMPLE + 1]; /* Specified command line options */ /* File names to read data from */ -static struct util_opt opt_vec[] = { - UTIL_OPT_SECTION("OPTIONS"), - { - .option = { "list-counters", no_argument, NULL, 'c' }, - .desc = "Lists counters for which the LPAR is authorized.", - }, - { - .option = { "list-all-counters", no_argument, NULL, 'C' }, - .desc = "Lists counters regardless of LPAR authorization.", - }, - { - .option = { "name", no_argument, NULL, 'n' }, - .desc = "Displays counter names.", - }, - { - .option = { "info", no_argument, NULL, 'i' }, - .desc = "Displays detailed information.", - }, - { - .option = { "list-sampling-events", no_argument, NULL, 's' }, - .desc = "Lists sampling events for which the LPAR is authorized.", - }, - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; - static const struct util_prg prg = { .desc = "List CPU Measurement facility charactertics", .copyright_vec = { @@ -4159,7 +4134,7 @@ int main(int argc, char **argv) int ret; util_prg_init(&prg); - util_opt_init(opt_vec, NULL); + util_opt_init(lscpumf_opt_vec, NULL); ret = parse_args(argc, argv); if (read_info() == EXIT_FAILURE) diff --git a/cpumf/lscpumf_cli.h b/cpumf/lscpumf_cli.h new file mode 100644 index 00000000..eaa0aedc --- /dev/null +++ b/cpumf/lscpumf_cli.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Command line utilities - for lscpumf + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef LSCPUMF_CLI_H +#define LSCPUMF_CLI_H + +#include "lib/util_fmt.h" +#include "lib/util_opt.h" + +static struct util_opt lscpumf_opt_vec[] = { + UTIL_OPT_SECTION("OPTIONS"), + { + .option = { "list-counters", no_argument, NULL, 'c' }, + .desc = "Lists counters for which the LPAR is authorized.", + }, + { + .option = { "list-all-counters", no_argument, NULL, 'C' }, + .desc = "Lists counters regardless of LPAR authorization.", + }, + { + .option = { "name", no_argument, NULL, 'n' }, + .desc = "Displays counter names.", + }, + { + .option = { "info", no_argument, NULL, 'i' }, + .desc = "Displays detailed information.", + }, + { + .option = { "list-sampling-events", no_argument, NULL, 's' }, + .desc = "Lists sampling events for which the LPAR is authorized.", + }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif diff --git a/cpumf/lshwc.c b/cpumf/lshwc.c index c11798f0..6772aa5a 100644 --- a/cpumf/lshwc.c +++ b/cpumf/lshwc.c @@ -43,6 +43,7 @@ #include "lib/libcpumf.h" #include "lshwc.h" +#include "lshwc_cli.h" #define CPUS_ONLINE "/sys/devices/system/cpu/online" #define CPUS_POSSIBLE "/sys/devices/system/cpu/possible" @@ -732,67 +733,6 @@ static int do_it(char *s) return rc ? EXIT_FAILURE : EXIT_SUCCESS; } -static struct util_opt opt_vec[] = { - UTIL_OPT_SECTION("OPTIONS"), - { - .option = { "all", no_argument, NULL, 'a' }, - .desc = "Displays all CPUs in output" - }, - { - .option = { "loop", required_argument, NULL, 'l' }, - .argument = "NUMBER", - .desc = "Specifies loop count for next read" - }, - { - .option = { "interval", required_argument, NULL, 'i' }, - .argument = "NUMBER", - .desc = "Specifies interval between read operations (seconds)" - }, - { - .option = { "short", no_argument, NULL, 's' }, - .desc = "Abbreviate counter name with counter set letter and number" - }, - { - .option = { "hex0x", no_argument, NULL, 'X' }, - .desc = "Counter values in hexadecimal format with leading 0x" - }, - { - .option = { "hex", no_argument, NULL, 'x' }, - .desc = "Counter values in hexadecimal format" - }, - { - .option = { "hide", no_argument, NULL, 'H' }, - .desc = "Do not display undefined counters of a counter set" - }, - { - .option = { "delta", no_argument, NULL, 'd' }, - .desc = "Display delta counter values" - }, - { - .option = { "timeout", required_argument, NULL, 't' }, - .argument = "NUMBER", - .desc = "run time in s (seconds) m (minutes) h (hours) and d (days)" - }, - { - .option = { "quote-all", no_argument, NULL, 'q' }, - .desc = "Apply quoting to all output elements" - }, - { - .option = { "format", required_argument, NULL, 'f' }, - .argument = "FORMAT", - .desc = "List counters in specified FORMAT (" FMT_TYPE_NAMES ")" - }, - { - .option = { "counters", required_argument, NULL, 'c' }, - .argument = "LIST", - .flags = UTIL_OPT_FLAG_NOSHORT, - .desc = "Specify comma separated list of counters to display" - }, - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; - static const struct util_prg prg = { .desc = "Read CPU Measurement facility counter sets", .copyright_vec = { @@ -823,7 +763,7 @@ int main(int argc, char **argv) int ch; util_prg_init(&prg); - util_opt_init(opt_vec, NULL); + util_opt_init(lshwc_opt_vec, NULL); while ((ch = util_opt_getopt_long(argc, argv)) != -1) { switch (ch) { diff --git a/cpumf/lshwc_cli.h b/cpumf/lshwc_cli.h new file mode 100644 index 00000000..f079e608 --- /dev/null +++ b/cpumf/lshwc_cli.h @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Command line utilities - for lshwc + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef LSHWC_CLI_H +#define LSHWC_CLI_H + +#include "lib/util_fmt.h" +#include "lib/util_opt.h" + +static struct util_opt lshwc_opt_vec[] = { + UTIL_OPT_SECTION("OPTIONS"), + { + .option = { "all", no_argument, NULL, 'a' }, + .desc = "Displays all CPUs in output" + }, + { + .option = { "loop", required_argument, NULL, 'l' }, + .argument = "NUMBER", + .desc = "Specifies loop count for next read" + }, + { + .option = { "interval", required_argument, NULL, 'i' }, + .argument = "NUMBER", + .desc = "Specifies interval between read operations (seconds)" + }, + { + .option = { "short", no_argument, NULL, 's' }, + .desc = "Abbreviate counter name with counter set letter and number" + }, + { + .option = { "hex0x", no_argument, NULL, 'X' }, + .desc = "Counter values in hexadecimal format with leading 0x" + }, + { + .option = { "hex", no_argument, NULL, 'x' }, + .desc = "Counter values in hexadecimal format" + }, + { + .option = { "hide", no_argument, NULL, 'H' }, + .desc = "Do not display undefined counters of a counter set" + }, + { + .option = { "delta", no_argument, NULL, 'd' }, + .desc = "Display delta counter values" + }, + { + .option = { "timeout", required_argument, NULL, 't' }, + .argument = "NUMBER", + .desc = "run time in s (seconds) m (minutes) h (hours) and d (days)" + }, + { + .option = { "quote-all", no_argument, NULL, 'q' }, + .desc = "Apply quoting to all output elements" + }, + { + .option = { "format", required_argument, NULL, 'f' }, + .argument = "FORMAT", + .desc = "List counters in specified FORMAT (" FMT_TYPE_NAMES ")" + }, + { + .option = { "counters", required_argument, NULL, 'c' }, + .argument = "LIST", + .flags = UTIL_OPT_FLAG_NOSHORT, + .desc = "Specify comma separated list of counters to display" + }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif diff --git a/cpumf/lspai.c b/cpumf/lspai.c index 8df91387..cb7f39f2 100644 --- a/cpumf/lspai.c +++ b/cpumf/lspai.c @@ -35,69 +35,7 @@ #include "lib/util_str.h" #include "lib/libcpumf.h" -#define STR_SUB(x) #x -#define STR(x) STR_SUB(x) - -#define OPT_FORMAT 256 /* --format XXX option */ -#define DEFAULT_LOOP_INTERVAL 60 /* loop interval in seconds */ - -static struct util_opt opt_vec[] = { - UTIL_OPT_SECTION("OPTIONS"), - { - .option = { "all", no_argument, NULL, 'a' }, - .desc = "Displays all CPUs in output" - }, - { - .option = { "delta", no_argument, NULL, 'd' }, - .desc = "Display delta counter values" - }, - { - .option = { "counters", required_argument, NULL, 'c' }, - .argument = "LIST", - .desc = "Specify comma separated list of counters to display" - }, - { - .option = { "format", required_argument, NULL, OPT_FORMAT }, - .argument = "FORMAT", - .flags = UTIL_OPT_FLAG_NOSHORT, - .desc = "List counters in specified FORMAT (" FMT_TYPE_NAMES ")" - }, - { - .option = { "loops", required_argument, NULL, 'l' }, - .argument = "COUNT", - .desc = "Number of read operations" - }, - { - .option = { "interval", required_argument, NULL, 'i' }, - .argument = "SECONDS", - .desc = "Time to wait between loop iterations (default " - STR(DEFAULT_LOOP_INTERVAL) "s)" - }, - { - .option = { "numeric", no_argument, NULL, 'n' }, - .desc = "Sort PAI counters by counter number" - }, - { - .option = { "short", no_argument, NULL, 's' }, - .desc = "Abbreviate counter name with counter set letter and number" - }, - { - .option = { "type", required_argument, NULL, 't' }, - .argument = "TYPE", - .desc = "Type of PAI counters to show: crypto, nnpa" - }, - { - .option = { "hex0x", no_argument, NULL, 'X' }, - .desc = "Counter values in hexadecimal format with leading 0x" - }, - { - .option = { "hex", no_argument, NULL, 'x' }, - .desc = "Counter values in hexadecimal format" - }, - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; +#include "lspai_cli.h" static const struct util_prg prg = { .desc = "List Processor Assist Information counter sets", @@ -727,7 +665,7 @@ int main(int argc, char **argv) util_list_init(&pai_list, struct pai_node, node); util_prg_init(&prg); - util_opt_init(opt_vec, NULL); + util_opt_init(lspai_opt_vec, NULL); while ((ch = util_opt_getopt_long(argc, argv)) != -1) { switch (ch) { diff --git a/cpumf/lspai_cli.h b/cpumf/lspai_cli.h new file mode 100644 index 00000000..37ffaf84 --- /dev/null +++ b/cpumf/lspai_cli.h @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Command line utilities - for lspai + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef LSPAI_CLI_H +#define LSPAI_CLI_H + +#include "lib/util_fmt.h" +#include "lib/util_opt.h" + +#define STR_SUB(x) #x +#define STR(x) STR_SUB(x) + +#define OPT_FORMAT 256 /* --format XXX option */ +#define DEFAULT_LOOP_INTERVAL 60 /* loop interval in seconds */ + +static struct util_opt lspai_opt_vec[] = { + UTIL_OPT_SECTION("OPTIONS"), + { + .option = { "all", no_argument, NULL, 'a' }, + .desc = "Displays all CPUs in output" + }, + { + .option = { "delta", no_argument, NULL, 'd' }, + .desc = "Display delta counter values" + }, + { + .option = { "counters", required_argument, NULL, 'c' }, + .argument = "LIST", + .desc = "Specify comma separated list of counters to display" + }, + { + .option = { "format", required_argument, NULL, OPT_FORMAT }, + .argument = "FORMAT", + .flags = UTIL_OPT_FLAG_NOSHORT, + .desc = "List counters in specified FORMAT (" FMT_TYPE_NAMES ")" + }, + { + .option = { "loops", required_argument, NULL, 'l' }, + .argument = "COUNT", + .desc = "Number of read operations" + }, + { + .option = { "interval", required_argument, NULL, 'i' }, + .argument = "SECONDS", + .desc = "Time to wait between loop iterations (default " + STR(DEFAULT_LOOP_INTERVAL) "s)" + }, + { + .option = { "numeric", no_argument, NULL, 'n' }, + .desc = "Sort PAI counters by counter number" + }, + { + .option = { "short", no_argument, NULL, 's' }, + .desc = "Abbreviate counter name with counter set letter and number" + }, + { + .option = { "type", required_argument, NULL, 't' }, + .argument = "TYPE", + .desc = "Type of PAI counters to show: crypto, nnpa" + }, + { + .option = { "hex0x", no_argument, NULL, 'X' }, + .desc = "Counter values in hexadecimal format with leading 0x" + }, + { + .option = { "hex", no_argument, NULL, 'x' }, + .desc = "Counter values in hexadecimal format" + }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif diff --git a/cpumf/pai.c b/cpumf/pai.c index 8e020f84..0ff7fa23 100644 --- a/cpumf/pai.c +++ b/cpumf/pai.c @@ -40,7 +40,9 @@ #include "lib/util_prg.h" #include "lib/util_scandir.h" #include "lib/libcpumf.h" + #include "pai.h" +#include "pai_cli.h" #define S390_EVT_PAI_CRYPTO 0x1000 #define S390_EVT_PAI_NNPA 0x1800 @@ -925,54 +927,6 @@ static void parse_cpulist(int enr, const char *parm) } } -static struct util_opt opt_vec[] = { - UTIL_OPT_SECTION("OPTIONS"), - { - .option = { "crypto", optional_argument, NULL, 'c' }, - .argument = "CPULIST[:DATA]", - .desc = "Collect PAI crypto counters" - }, - { - .option = { "nnpa", optional_argument, NULL, 'n' }, - .argument = "CPULIST[:DATA]", - .desc = "Collect PAI nnpa counters" - }, - { - .option = { "mapsize", required_argument, NULL, 'm' }, - .argument = "SIZE", - .desc = "Specifies number of 4KB pages for event ring buffer" - }, - { - .option = { "report", no_argument, NULL, 'r' }, - .desc = "Report file contents" - }, - { - .option = { "realtime", required_argument, NULL, 'R' }, - .argument = "PRIO", - .desc = "Collect data with this RT SCHED_FIFO priority" - }, - { - .option = { "interval", required_argument, NULL, 'i' }, - .argument = "NUMBER", - .desc = "Specifies interval between read operations in milliseconds" - }, - { - .option = { "verbose", no_argument, NULL, 'V' }, - .desc = "Verbose output" - }, - { - .option = { "humantime", no_argument, NULL, 'H' }, - .desc = "Human readable timestamp in seconds.nanoseconds" - }, - { - .option = { "summary", no_argument, NULL, 'S' }, - .desc = "Print summary of all non-zero counter values" - }, - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; - static const struct util_prg prg = { .desc = "Record and report Processor Activity Instrumentation Facility Counters.", .copyright_vec = { @@ -1038,7 +992,7 @@ int main(int argc, char **argv) util_list_init(&list_pai_event, struct pai_event, node); util_list_init(&list_pmu_event, struct pmu_events, node); util_prg_init(&prg); - util_opt_init(opt_vec, NULL); + util_opt_init(pai_opt_vec, NULL); /* Read currently online CPUs and create a bit mask. * This bitmap of online CPUs is used to check command line parameter diff --git a/cpumf/pai_cli.h b/cpumf/pai_cli.h new file mode 100644 index 00000000..278229d3 --- /dev/null +++ b/cpumf/pai_cli.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Command line utilities - for pai + * + * Copyright IBM Corp. 2025 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef PAI_CLI_H +#define PAI_CLI_H + +#include "lib/util_fmt.h" +#include "lib/util_opt.h" + +static struct util_opt pai_opt_vec[] = { + UTIL_OPT_SECTION("OPTIONS"), + { + .option = { "crypto", optional_argument, NULL, 'c' }, + .argument = "CPULIST[:DATA]", + .desc = "Collect PAI crypto counters" + }, + { + .option = { "nnpa", optional_argument, NULL, 'n' }, + .argument = "CPULIST[:DATA]", + .desc = "Collect PAI nnpa counters" + }, + { + .option = { "mapsize", required_argument, NULL, 'm' }, + .argument = "SIZE", + .desc = "Specifies number of 4KB pages for event ring buffer" + }, + { + .option = { "report", no_argument, NULL, 'r' }, + .desc = "Report file contents" + }, + { + .option = { "realtime", required_argument, NULL, 'R' }, + .argument = "PRIO", + .desc = "Collect data with this RT SCHED_FIFO priority" + }, + { + .option = { "interval", required_argument, NULL, 'i' }, + .argument = "NUMBER", + .desc = "Specifies interval between read operations in milliseconds" + }, + { + .option = { "verbose", no_argument, NULL, 'V' }, + .desc = "Verbose output" + }, + { + .option = { "humantime", no_argument, NULL, 'H' }, + .desc = "Human readable timestamp in seconds.nanoseconds" + }, + { + .option = { "summary", no_argument, NULL, 'S' }, + .desc = "Print summary of all non-zero counter values" + }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif