Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
6bbc4820 6282a1f4

+20 -11
+4
tools/perf/Documentation/perf-lock.txt
··· 40 40 --verbose:: 41 41 Be more verbose (show symbol address, etc). 42 42 43 + -q:: 44 + --quiet:: 45 + Do not show any message. (Suppress -v) 46 + 43 47 -D:: 44 48 --dump-raw-trace:: 45 49 Dump raw trace in ASCII.
+16 -11
tools/perf/builtin-lock.c
··· 1250 1250 for (i = 0; i < BROKEN_MAX; i++) 1251 1251 broken += bad_hist[i]; 1252 1252 1253 - if (broken == 0 && !verbose) 1253 + if (quiet || (broken == 0 && !verbose)) 1254 1254 return; 1255 1255 1256 1256 pr_info("\n=== output for debug===\n\n"); ··· 1269 1269 char cut_name[20]; 1270 1270 int bad, total, printed; 1271 1271 1272 - pr_info("%20s ", "Name"); 1273 - list_for_each_entry(key, &lock_keys, list) 1274 - pr_info("%*s ", key->len, key->header); 1275 - pr_info("\n\n"); 1272 + if (!quiet) { 1273 + pr_info("%20s ", "Name"); 1274 + list_for_each_entry(key, &lock_keys, list) 1275 + pr_info("%*s ", key->len, key->header); 1276 + pr_info("\n\n"); 1277 + } 1276 1278 1277 1279 bad = total = printed = 0; 1278 1280 while ((st = pop_from_result())) { ··· 1484 1482 struct lock_key *key; 1485 1483 int bad, total, printed; 1486 1484 1487 - list_for_each_entry(key, &lock_keys, list) 1488 - pr_info("%*s ", key->len, key->header); 1485 + if (!quiet) { 1486 + list_for_each_entry(key, &lock_keys, list) 1487 + pr_info("%*s ", key->len, key->header); 1489 1488 1490 - if (show_thread_stats) 1491 - pr_info(" %10s %s\n\n", "pid", "comm"); 1492 - else 1493 - pr_info(" %10s %s\n\n", "type", "caller"); 1489 + if (show_thread_stats) 1490 + pr_info(" %10s %s\n\n", "pid", "comm"); 1491 + else 1492 + pr_info(" %10s %s\n\n", "type", "caller"); 1493 + } 1494 1494 1495 1495 bad = total = printed = 0; 1496 1496 if (use_bpf) ··· 1869 1865 "file", "vmlinux pathname"), 1870 1866 OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, 1871 1867 "file", "kallsyms pathname"), 1868 + OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), 1872 1869 OPT_END() 1873 1870 }; 1874 1871