perf tools: Make quiet mode consistent between tools
authorJames Clark <james.clark@arm.com>
Tue, 18 Oct 2022 09:41:36 +0000 (10:41 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 27 Oct 2022 19:37:26 +0000 (16:37 -0300)
Use the global quiet variable everywhere so that all tools hide warnings
in quiet mode and update the documentation to reflect this.

'perf probe' claimed that errors are not printed in quiet mode but I
don't see this so remove it from the docs.

Signed-off-by: James Clark <james.clark@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20221018094137.783081-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
16 files changed:
tools/perf/Documentation/perf-annotate.txt
tools/perf/Documentation/perf-diff.txt
tools/perf/Documentation/perf-lock.txt
tools/perf/Documentation/perf-probe.txt
tools/perf/Documentation/perf-record.txt
tools/perf/Documentation/perf-report.txt
tools/perf/Documentation/perf-stat.txt
tools/perf/bench/numa.c
tools/perf/builtin-annotate.c
tools/perf/builtin-diff.c
tools/perf/builtin-lock.c
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-stat.c
tools/perf/util/stat.h

index 18fcc52809fbf1d297b8a666e54212ed442c7c0a..980fe2c292752a795e732898b9cbfa9ddd4b4b23 100644 (file)
@@ -41,7 +41,7 @@ OPTIONS
 
 -q::
 --quiet::
-       Do not show any message.  (Suppress -v)
+       Do not show any warnings or messages.  (Suppress -v)
 
 -n::
 --show-nr-samples::
index be65bd55ab2aadc2d0abb15ba0e7fb3a1c84c1dd..f3067a4af294081dddae4101cf65b4301c5e48a5 100644 (file)
@@ -75,7 +75,7 @@ OPTIONS
 
 -q::
 --quiet::
-       Do not show any message.  (Suppress -v)
+       Do not show any warnings or messages.  (Suppress -v)
 
 -f::
 --force::
index 3b1e16563b795188a7dec58b9f1b562705027081..4958a1ffa1cca0fab500c1cc3d1d0c3f579c93cd 100644 (file)
@@ -42,7 +42,7 @@ COMMON OPTIONS
 
 -q::
 --quiet::
-       Do not show any message. (Suppress -v)
+       Do not show any warnings or messages. (Suppress -v)
 
 -D::
 --dump-raw-trace::
index 080981d38d7ba910bc11c22e9b63e9d3d80222e6..7f8e8ba3a7872a757cb4362cb42bcca2cc48f3be 100644 (file)
@@ -57,7 +57,7 @@ OPTIONS
 
 -q::
 --quiet::
-       Be quiet (do not show any messages including errors).
+       Do not show any warnings or messages.
        Can not use with -v.
 
 -a::
index e41ae950fdc3b682e87b1f6d233021b782a0bdf7..9ea6d44aca58c8f6b567101ff41482134a687d24 100644 (file)
@@ -282,7 +282,7 @@ OPTIONS
 
 -q::
 --quiet::
-       Don't print any message, useful for scripting.
+       Don't print any warnings or messages, useful for scripting.
 
 -v::
 --verbose::
index 4533db2ee56bb31b53400ec523fb19cdc9288d76..4fa509b15948981504dd6e362c1371487418f7e4 100644 (file)
@@ -27,7 +27,7 @@ OPTIONS
 
 -q::
 --quiet::
-       Do not show any message.  (Suppress -v)
+       Do not show any warnings or messages.  (Suppress -v)
 
 -n::
 --show-nr-samples::
index d7ff1867feda63411340bb6cb311a1fc85111a3d..18abdc1dce0558c9481542e9d6dd9a153b054a38 100644 (file)
@@ -354,8 +354,8 @@ forbids the event merging logic from sharing events between groups and
 may be used to increase accuracy in this case.
 
 --quiet::
-Don't print output. This is useful with perf stat record below to only
-write data to the perf.data file.
+Don't print output, warnings or messages. This is useful with perf stat
+record below to only write data to the perf.data file.
 
 STAT RECORD
 -----------
index e78dedf9e682c68a09c81d5eb45a3616195d021a..9717c6c17433c22d7a605808a7800f4837cd35c1 100644 (file)
@@ -16,6 +16,7 @@
 #include <sched.h>
 #include <stdio.h>
 #include <assert.h>
+#include <debug.h>
 #include <malloc.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -116,7 +117,6 @@ struct params {
        long                    bytes_thread;
 
        int                     nr_tasks;
-       bool                    show_quiet;
 
        bool                    show_convergence;
        bool                    measure_convergence;
@@ -197,7 +197,8 @@ static const struct option options[] = {
        OPT_BOOLEAN('c', "show_convergence", &p0.show_convergence, "show convergence details, "
                    "convergence is reached when each process (all its threads) is running on a single NUMA node."),
        OPT_BOOLEAN('m', "measure_convergence", &p0.measure_convergence, "measure convergence latency"),
-       OPT_BOOLEAN('q', "quiet"        , &p0.show_quiet,       "quiet mode"),
+       OPT_BOOLEAN('q', "quiet"        , &quiet,
+                   "quiet mode (do not show any warnings or messages)"),
        OPT_BOOLEAN('S', "serialize-startup", &p0.serialize_startup,"serialize thread startup"),
 
        /* Special option string parsing callbacks: */
@@ -1474,7 +1475,7 @@ static int init(void)
        /* char array in count_process_nodes(): */
        BUG_ON(g->p.nr_nodes < 0);
 
-       if (g->p.show_quiet && !g->p.show_details)
+       if (quiet && !g->p.show_details)
                g->p.show_details = -1;
 
        /* Some memory should be specified: */
@@ -1553,7 +1554,7 @@ static void print_res(const char *name, double val,
        if (!name)
                name = "main,";
 
-       if (!g->p.show_quiet)
+       if (!quiet)
                printf(" %-30s %15.3f, %-15s %s\n", name, val, txt_unit, txt_short);
        else
                printf(" %14.3f %s\n", val, txt_long);
index f839e69492e804c373826c7289d77df93eec360b..517d928c00e3f6240d40c0406ea0ef4cce448138 100644 (file)
@@ -525,7 +525,7 @@ int cmd_annotate(int argc, const char **argv)
        OPT_BOOLEAN('f', "force", &data.force, "don't complain, do it"),
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
-       OPT_BOOLEAN('q', "quiet", &quiet, "do now show any message"),
+       OPT_BOOLEAN('q', "quiet", &quiet, "do now show any warnings or messages"),
        OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
                    "dump raw trace in ASCII"),
 #ifdef HAVE_GTK2_SUPPORT
index d925096dd7f02120fdc18474dcc9dc98298f1665..ed07cc6cca56ccbd651c43bed022dcc3ada06380 100644 (file)
@@ -1260,7 +1260,7 @@ static const char * const diff_usage[] = {
 static const struct option options[] = {
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
-       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
+       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any warnings or messages"),
        OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
                    "Show only items with match in baseline"),
        OPT_CALLBACK('c', "compute", &compute,
index 9722d4ab2e55732e248abab72cc0c403d11ac4b9..66520712a16752346fce1095e5540807aa07d67c 100644 (file)
@@ -1869,7 +1869,7 @@ int cmd_lock(int argc, const char **argv)
                   "file", "vmlinux pathname"),
        OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
                   "file", "kallsyms pathname"),
-       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
+       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any warnings or messages"),
        OPT_END()
        };
 
index f62298f5db3b442478329eb30c58a582277646f4..2ae50fc9e59763924fdaca4c86bd94e9c2fe6d98 100644 (file)
@@ -40,7 +40,6 @@ static struct {
        int command;    /* Command short_name */
        bool list_events;
        bool uprobes;
-       bool quiet;
        bool target_used;
        int nevents;
        struct perf_probe_event events[MAX_PROBES];
@@ -514,8 +513,8 @@ __cmd_probe(int argc, const char **argv)
        struct option options[] = {
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show parsed arguments, etc)"),
-       OPT_BOOLEAN('q', "quiet", &params.quiet,
-                   "be quiet (do not show any messages)"),
+       OPT_BOOLEAN('q', "quiet", &quiet,
+                   "be quiet (do not show any warnings or messages)"),
        OPT_CALLBACK_DEFAULT('l', "list", NULL, "[GROUP:]EVENT",
                             "list up probe events",
                             opt_set_filter_with_command, DEFAULT_LIST_FILTER),
@@ -634,7 +633,7 @@ __cmd_probe(int argc, const char **argv)
        if (ret)
                return ret;
 
-       if (params.quiet) {
+       if (quiet) {
                if (verbose != 0) {
                        pr_err("  Error: -v and -q are exclusive.\n");
                        return -EINVAL;
index e128b855dddec15e28eb183c9db52bf1bb74d194..59f3d98a0196d1cf80250214ddc2e1f8dc292a8f 100644 (file)
@@ -3388,7 +3388,7 @@ static struct option __record_options[] = {
                     &record_parse_callchain_opt),
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show counter open errors, etc)"),
-       OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
+       OPT_BOOLEAN('q', "quiet", &quiet, "don't print any warnings or messages"),
        OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
                    "per thread counts"),
        OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
index 8361890176c23584ede91f5da7900ab0bc2aa23e..b6d77d3da64f6f7e1fc28c383b87a9738e5dc18a 100644 (file)
@@ -1222,7 +1222,7 @@ int cmd_report(int argc, const char **argv)
                    "input file name"),
        OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
-       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
+       OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any warnings or messages"),
        OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
                    "dump raw trace in ASCII"),
        OPT_BOOLEAN(0, "stats", &report.stats_mode, "Display event stats"),
index 9d35a33389766a99d8d22b0cde5fdc20b4253464..e52601a54b26d669f1e6f604b14cdcb0e93d501a 100644 (file)
@@ -1033,7 +1033,7 @@ static void print_counters(struct timespec *ts, int argc, const char **argv)
        /* Do not print anything if we record to the pipe. */
        if (STAT_RECORD && perf_stat.data.is_pipe)
                return;
-       if (stat_config.quiet)
+       if (quiet)
                return;
 
        evlist__print_counters(evsel_list, &stat_config, &target, ts, argc, argv);
@@ -1283,8 +1283,8 @@ static struct option stat_options[] = {
                       "print summary for interval mode"),
        OPT_BOOLEAN(0, "no-csv-summary", &stat_config.no_csv_summary,
                       "don't print 'summary' for CSV summary output"),
-       OPT_BOOLEAN(0, "quiet", &stat_config.quiet,
-                       "don't print output (useful with record)"),
+       OPT_BOOLEAN(0, "quiet", &quiet,
+                       "don't print any output, messages or warnings (useful with record)"),
        OPT_CALLBACK(0, "cputype", &evsel_list, "hybrid cpu type",
                     "Only enable events on applying cpu with this type "
                     "for hybrid platform (e.g. core or atom)",
@@ -2383,7 +2383,7 @@ int cmd_stat(int argc, const char **argv)
                goto out;
        }
 
-       if (!output && !stat_config.quiet) {
+       if (!output && !quiet) {
                struct timespec tm;
                mode = append_file ? "a" : "w";
 
index 382a1ab92ce1833836823170f5c88a20269e7cd4..499c3bf813336ea97fdb91c0b4171365c3d963ba 100644 (file)
@@ -160,7 +160,6 @@ struct perf_stat_config {
        bool                     metric_no_group;
        bool                     metric_no_merge;
        bool                     stop_read_counter;
-       bool                     quiet;
        bool                     iostat_run;
        char                     *user_requested_cpu_list;
        bool                     system_wide;