Commit 6bbc4820 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf lock: Add -q/--quiet option to suppress header and debug messages

Like in 'perf report', this option is to suppress header and debug messages.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220924004221.841024-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6282a1f4
...@@ -40,6 +40,10 @@ COMMON OPTIONS ...@@ -40,6 +40,10 @@ COMMON OPTIONS
--verbose:: --verbose::
Be more verbose (show symbol address, etc). Be more verbose (show symbol address, etc).
-q::
--quiet::
Do not show any message. (Suppress -v)
-D:: -D::
--dump-raw-trace:: --dump-raw-trace::
Dump raw trace in ASCII. Dump raw trace in ASCII.
......
...@@ -1250,7 +1250,7 @@ static void print_bad_events(int bad, int total) ...@@ -1250,7 +1250,7 @@ static void print_bad_events(int bad, int total)
for (i = 0; i < BROKEN_MAX; i++) for (i = 0; i < BROKEN_MAX; i++)
broken += bad_hist[i]; broken += bad_hist[i];
if (broken == 0 && !verbose) if (quiet || (broken == 0 && !verbose))
return; return;
pr_info("\n=== output for debug===\n\n"); pr_info("\n=== output for debug===\n\n");
...@@ -1269,10 +1269,12 @@ static void print_result(void) ...@@ -1269,10 +1269,12 @@ static void print_result(void)
char cut_name[20]; char cut_name[20];
int bad, total, printed; int bad, total, printed;
pr_info("%20s ", "Name"); if (!quiet) {
list_for_each_entry(key, &lock_keys, list) pr_info("%20s ", "Name");
pr_info("%*s ", key->len, key->header); list_for_each_entry(key, &lock_keys, list)
pr_info("\n\n"); pr_info("%*s ", key->len, key->header);
pr_info("\n\n");
}
bad = total = printed = 0; bad = total = printed = 0;
while ((st = pop_from_result())) { while ((st = pop_from_result())) {
...@@ -1482,13 +1484,15 @@ static void print_contention_result(struct lock_contention *con) ...@@ -1482,13 +1484,15 @@ static void print_contention_result(struct lock_contention *con)
struct lock_key *key; struct lock_key *key;
int bad, total, printed; int bad, total, printed;
list_for_each_entry(key, &lock_keys, list) if (!quiet) {
pr_info("%*s ", key->len, key->header); list_for_each_entry(key, &lock_keys, list)
pr_info("%*s ", key->len, key->header);
if (show_thread_stats) if (show_thread_stats)
pr_info(" %10s %s\n\n", "pid", "comm"); pr_info(" %10s %s\n\n", "pid", "comm");
else else
pr_info(" %10s %s\n\n", "type", "caller"); pr_info(" %10s %s\n\n", "type", "caller");
}
bad = total = printed = 0; bad = total = printed = 0;
if (use_bpf) if (use_bpf)
...@@ -1865,6 +1869,7 @@ int cmd_lock(int argc, const char **argv) ...@@ -1865,6 +1869,7 @@ int cmd_lock(int argc, const char **argv)
"file", "vmlinux pathname"), "file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
"file", "kallsyms pathname"), "file", "kallsyms pathname"),
OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_END() OPT_END()
}; };
......
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