Commit b3c63d7a authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

veristat: add -d debug mode option to see debug libbpf log

Add -d option to allow requesting libbpf debug logs from veristat.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230327185202.1929145-3-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent d6e6286a
...@@ -135,6 +135,7 @@ static struct env { ...@@ -135,6 +135,7 @@ static struct env {
char **filenames; char **filenames;
int filename_cnt; int filename_cnt;
bool verbose; bool verbose;
bool debug;
bool quiet; bool quiet;
int log_level; int log_level;
enum resfmt out_fmt; enum resfmt out_fmt;
...@@ -169,7 +170,7 @@ static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va ...@@ -169,7 +170,7 @@ static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va
{ {
if (!env.verbose) if (!env.verbose)
return 0; return 0;
if (level == LIBBPF_DEBUG /* && !env.verbose */) if (level == LIBBPF_DEBUG && !env.debug)
return 0; return 0;
return vfprintf(stderr, format, args); return vfprintf(stderr, format, args);
} }
...@@ -186,6 +187,7 @@ static const struct argp_option opts[] = { ...@@ -186,6 +187,7 @@ static const struct argp_option opts[] = {
{ NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" }, { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
{ "verbose", 'v', NULL, 0, "Verbose mode" }, { "verbose", 'v', NULL, 0, "Verbose mode" },
{ "log-level", 'l', "LEVEL", 0, "Verifier log level (default 0 for normal mode, 1 for verbose mode)" }, { "log-level", 'l', "LEVEL", 0, "Verifier log level (default 0 for normal mode, 1 for verbose mode)" },
{ "debug", 'd', NULL, 0, "Debug mode (turns on libbpf debug logging)" },
{ "quiet", 'q', NULL, 0, "Quiet mode" }, { "quiet", 'q', NULL, 0, "Quiet mode" },
{ "emit", 'e', "SPEC", 0, "Specify stats to be emitted" }, { "emit", 'e', "SPEC", 0, "Specify stats to be emitted" },
{ "sort", 's', "SPEC", 0, "Specify sort order" }, { "sort", 's', "SPEC", 0, "Specify sort order" },
...@@ -212,6 +214,10 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) ...@@ -212,6 +214,10 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
case 'v': case 'v':
env.verbose = true; env.verbose = true;
break; break;
case 'd':
env.debug = true;
env.verbose = true;
break;
case 'q': case 'q':
env.quiet = true; env.quiet = true;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment