libbpf-tools: parse -h option
authorHengqi Chen <chenhengqi@outlook.com>
Sat, 15 May 2021 15:15:03 +0000 (23:15 +0800)
committeryonghong-song <ys114321@gmail.com>
Thu, 20 May 2021 05:37:38 +0000 (22:37 -0700)
Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
26 files changed:
libbpf-tools/biolatency.c
libbpf-tools/biopattern.c
libbpf-tools/biosnoop.c
libbpf-tools/biostacks.c
libbpf-tools/bitesize.c
libbpf-tools/cachestat.c
libbpf-tools/cpudist.c
libbpf-tools/cpufreq.c
libbpf-tools/drsnoop.c
libbpf-tools/execsnoop.c
libbpf-tools/ext4dist.c
libbpf-tools/filelife.c
libbpf-tools/hardirqs.c
libbpf-tools/llcstat.c
libbpf-tools/numamove.c
libbpf-tools/offcputime.c
libbpf-tools/readahead.c
libbpf-tools/runqlat.c
libbpf-tools/runqlen.c
libbpf-tools/runqslower.c
libbpf-tools/softirqs.c
libbpf-tools/syscount.c
libbpf-tools/tcpconnect.c
libbpf-tools/tcpconnlat.c
libbpf-tools/vfsstat.c
libbpf-tools/xfsslower.c

index fa90ac1224bc14bc904b65d54d94c60b679af8b0..a09ebf29e3b3eccb84ae49d2aed1d20612d7c953 100644 (file)
@@ -60,6 +60,7 @@ static const struct argp_option opts[] = {
        { "flag", 'F', NULL, 0, "Print a histogram per set of I/O flags" },
        { "disk",  'd', "DISK",  0, "Trace this disk only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -68,6 +69,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 12ed8ffb621f7fa2513176989f6043bc25bf3c8a..e5bebaa25c622168a413bc66e490153749f28ad8 100644 (file)
@@ -45,6 +45,7 @@ static const struct argp_option opts[] = {
        { "timestamp", 'T', NULL, 0, "Include timestamp on output" },
        { "disk",  'd', "DISK",  0, "Trace this disk only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -53,6 +54,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 916e0bd13fcb0574df0b759b9eb28530231ad1b7..42a9a06cc2f731900a809710ea94feb6535fb4ac 100644 (file)
@@ -46,6 +46,7 @@ static const struct argp_option opts[] = {
        { "queued", 'Q', NULL, 0, "Include OS queued time in I/O time" },
        { "disk",  'd', "DISK",  0, "Trace this disk only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -54,6 +55,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 82acb06314373b6fb26b9d11908836065a3a1fa8..1bf93fa3c408192784313f802fb0c8fafaf0e372 100644 (file)
@@ -39,6 +39,7 @@ static const struct argp_option opts[] = {
        { "disk",  'd', "DISK",  0, "Trace this disk only" },
        { "milliseconds", 'm', NULL, 0, "Millisecond histogram" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -47,6 +48,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index b127d76be10ce0a802cfdc3c0b6583aaa6fcc6ab..80b9b0d7037c7b10c8d1d385c821675bd559623d 100644 (file)
@@ -48,6 +48,7 @@ static const struct argp_option opts[] = {
        { "comm",  'c', "COMM",  0, "Trace this comm only" },
        { "disk",  'd', "DISK",  0, "Trace this disk only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -56,6 +57,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args, len;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 6caab21c09edb8a6f70c55286e6b3e4af212bf20..b308c5acda419b22815f8bce74b479160e3e554f 100644 (file)
@@ -41,6 +41,7 @@ const char argp_program_doc[] =
 static const struct argp_option opts[] = {
        { "timestamp", 'T', NULL, 0, "Print timestamp" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -49,6 +50,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index fa00a424f0203df09c7d1156c915d4b309ac3e17..5827883f7e4e8ba2d395dba6878bdcab6bde3649 100644 (file)
@@ -56,6 +56,7 @@ static const struct argp_option opts[] = {
        { "tids", 'L', NULL, 0, "Print a histogram per thread ID" },
        { "pid", 'p', "PID", 0, "Trace this PID only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -64,6 +65,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 9a2ed3488bb813a5fd4536ebefdcaa89e40f2e44..b12d2b78b0978e7614b9b38013c8e71151ca3c6f 100644 (file)
@@ -43,12 +43,16 @@ static const struct argp_option opts[] = {
        { "duration", 'd', "DURATION", 0, "Duration to sample in seconds" },
        { "frequency", 'f', "FREQUENCY", 0, "Sample with a certain frequency" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
 static error_t parse_arg(int key, char *arg, struct argp_state *state)
 {
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 7016bb1233324f9ab46bec295cd1895047948750..3bb827f2022a21e3b869a6662f9a36890bcc100f 100644 (file)
@@ -47,6 +47,7 @@ static const struct argp_option opts[] = {
        { "pid", 'p', "PID", 0, "Process PID to trace" },
        { "tid", 't', "TID", 0, "Thread TID to trace" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -58,6 +59,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        int pid;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 47520f611eb1f19e5e0bc11a7f45d073a0889171..3ea7049355ef998b0efda138404cb83f3de5b05d 100644 (file)
@@ -67,6 +67,7 @@ static const struct argp_option opts[] = {
        { "max-args", MAX_ARGS_KEY, "MAX_ARGS", 0,
                "maximum number of arguments parsed and displayed, defaults to 20"},
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -76,7 +77,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
 
        switch (key) {
        case 'h':
-               argp_usage(state);
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
                break;
        case 'T':
                env.time = true;
index ee4131d4850e65a3ec02cea10a090575909574bb..5f7559d221ef2783decf0214ee9a067ba03709ce 100644 (file)
@@ -49,6 +49,7 @@ static const struct argp_option opts[] = {
        { "milliseconds", 'm', NULL, 0, "Millisecond histogram" },
        { "pid", 'p', "PID", 0, "Process PID to trace" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -57,6 +58,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index e0f6d8e277631c89e9a8771a5feb5170afbe057a..4c45a2cb414188a277a72cd5aaf80c0aed08de2e 100644 (file)
@@ -38,6 +38,7 @@ const char argp_program_doc[] =
 static const struct argp_option opts[] = {
        { "pid", 'p', "PID", 0, "Process PID to trace" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -46,6 +47,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        int pid;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 5e4a6fd2677f626e36a5c719301ff600a105f362..b97b2e0e1079cb3f7db183ab7a79824b30774472 100644 (file)
@@ -51,6 +51,7 @@ static const struct argp_option opts[] = {
        { "timestamp", 'T', NULL, 0, "Include timestamp on output" },
        { "nanoseconds", 'N', NULL, 0, "Output in nanoseconds" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -59,6 +60,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 91c17321c950b64e39bdf13689d68d6b76ac8bb3..13e9f0fb593b563d0204e5f0b226fe85569ac907 100644 (file)
@@ -39,6 +39,7 @@ static const struct argp_option opts[] = {
        { "sample_period", 'c', "SAMPLE_PERIOD", 0, "Sample one in this many "
          "number of cache reference / miss events" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -47,6 +48,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 21b1d550e1089a17e9e1550c927530659f384c53..01ad6765a1cf7a688999187ae6bbea609de302d9 100644 (file)
@@ -32,12 +32,16 @@ const char argp_program_doc[] =
 
 static const struct argp_option opts[] = {
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
 static error_t parse_arg(int key, char *arg, struct argp_state *state)
 {
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 341e271c2a0db352855e249c1a0f1d1143278514..b45f7e6db98ce8dd211074c242fc08be2f199983 100644 (file)
@@ -80,6 +80,7 @@ static const struct argp_option opts[] = {
          "the amount of time in microseconds under which we store traces (default U64_MAX)" },
        { "state", OPT_STATE, "STATE", 0, "filter on this thread state bitmask (eg, 2 == TASK_UNINTERRUPTIBLE) see include/linux/sched.h" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -88,6 +89,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index debd9eb074a91a67248436b16c6abe811c2f7490..2ab654e0ed558b7c58fce7b7f5c25c46ce127fce 100644 (file)
@@ -37,12 +37,16 @@ const char argp_program_doc[] =
 static const struct argp_option opts[] = {
        { "duration", 'd', "DURATION", 0, "Duration to trace"},
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
 static error_t parse_arg(int key, char *arg, struct argp_state *state)
 {
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 512f2b4ad940e4ecee6e7a56106dc9bd75f9cb89..bfa79ef495ca4ef005409fe85756b754314fe3d9 100644 (file)
@@ -58,6 +58,7 @@ static const struct argp_option opts[] = {
        { "tids", 'L', NULL, 0, "Print a histogram per thread ID" },
        { "pid", 'p', "PID", 0, "Trace this PID only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -66,6 +67,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index e2375549188c1c22f9dc01299d6fa3c618a28760..5caa841b95b41259fa9ebc6769dd0551f89edcb9 100644 (file)
@@ -62,6 +62,7 @@ static const struct argp_option opts[] = {
        { "runqocc", 'O', NULL, 0, "Report run queue occupancy" },
        { "timestamp", 'T', NULL, 0, "Include timestamp on output" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -70,6 +71,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 88381671f7089a0329d48115523e547d476ad4a6..7654ae940c87f197bd25c7a45471869b34cc9325 100644 (file)
@@ -41,6 +41,7 @@ static const struct argp_option opts[] = {
        { "pid", 'p', "PID", 0, "Process PID to trace"},
        { "tid", 't', "TID", 0, "Thread TID to trace"},
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -51,6 +52,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        long long min_us;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 0d58181f2e8594e148cff68e4ec0fffa813f2881..3a7cd2fc91dc8b29c41f360a44d4d24a65247723 100644 (file)
@@ -49,6 +49,7 @@ static const struct argp_option opts[] = {
        { "timestamp", 'T', NULL, 0, "Include timestamp on output" },
        { "nanoseconds", 'N', NULL, 0, "Output in nanoseconds" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -57,6 +58,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 81a5a939420c17d2154f6f3d229604ceb1a56ce1..262b986ea49699593bab1e07c3dc6eeb1e6dacf8 100644 (file)
@@ -56,6 +56,7 @@ static const struct argp_option opts[] = {
        { "errno", 'e', "ERRNO", 0, "Trace only syscalls that return this error"
                                 "(numeric or EPERM, etc.)" },
        { "list", 'l', NULL, 0, "Print list of recognized syscalls and exit" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -288,6 +289,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        int err;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index c8147bdf2d912371f82ef98f3af98a0e7fe65ccf..d71f981738afc7fbfe730f617e124ce32d6fdf80 100644 (file)
@@ -111,6 +111,7 @@ static const struct argp_option opts[] = {
          "Comma-separated list of destination ports to trace" },
        { "cgroupmap", 'C', "PATH", 0, "trace cgroups in this map" },
        { "mntnsmap", 'M', "PATH", 0, "trace mount namespaces in this map" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -133,6 +134,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        int nports;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 4b028671cd1192ef429becd8fb133f596070c648..7cd74619dfcdd19a23f7e964953f09c43f28ec27 100644 (file)
@@ -43,6 +43,7 @@ static const struct argp_option opts[] = {
        { "timestamp", 't', NULL, 0, "Include timestamp on output" },
        { "pid", 'p', "PID", 0, "Trace this PID only" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -51,6 +52,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        static int pos_args;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 634012d3c57e7872196e81ccb2a29b10a7c7b2a9..b89a6c8e8f02546f096fcf53fecd86fda4c4892c 100644 (file)
@@ -23,6 +23,7 @@ static char args_doc[] = "[interval [count]]";
 
 static const struct argp_option opts[] = {
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -40,6 +41,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        long count;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;
index 5602c872fac3e6f5cd0e1eb5276d1b91924d68ef..9f000d95dc718c8790086a66b93f16f03b44dc79 100644 (file)
@@ -49,6 +49,7 @@ static const struct argp_option opts[] = {
        { "pid", 'p', "PID", 0, "Process PID to trace" },
        { "min", 'm', "MIN", 0, "Min latency of trace in ms (default 10)" },
        { "verbose", 'v', NULL, 0, "Verbose debug output" },
+       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
        {},
 };
 
@@ -59,6 +60,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
        int pid;
 
        switch (key) {
+       case 'h':
+               argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
+               break;
        case 'v':
                env.verbose = true;
                break;