Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1583187 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2017-02-17 09:20 +0100 |
| Last post | 2017-02-21 09:20 +0100 |
| Articles | 13 — 4 participants |
Back to article view | Back to linux.kernel
[PATCHSET 0/6] perf tools: Add -q/--quiet option to suppress messages (v1) Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
[PATCH 1/6] perf utils: Add perf_quiet_option() Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
[tip:perf/urgent] perf utils: Add perf_quiet_option() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
[PATCH 4/6] perf diff: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
[tip:perf/urgent] perf diff: Add -q/--quiet option tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
[PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
Re: [PATCH 3/6] perf report: Add -q/--quiet option Jiri Olsa <jolsa@redhat.com> - 2017-02-17 12:20 +0100
Re: [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-19 01:40 +0100
Re: [PATCH 3/6] perf report: Add -q/--quiet option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-20 20:10 +0100
Re: [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-21 02:50 +0100
[tip:perf/urgent] perf report: Add -q/--quiet option tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
[PATCH 6/6] perf record: Honor quiet option properly Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
[tip:perf/urgent] perf record: Honor --quiet option properly tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-17 09:20 +0100 |
| Subject | [PATCHSET 0/6] perf tools: Add -q/--quiet option to suppress messages (v1) |
| Message-ID | <tbLVL-1GO-3@gated-at.bofh.it> |
Hello, The -q/--quiet option is to suppress headers or messages (in stdio) so that it can be copied to other place if users just want to see the numbers. This was suggested by Arnaldo. Note that this patchset only implements it in a couple of commands. If it seems ok, it can be applied to others later. The code also is available at 'perf/quiet-v1' branch in my tree git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git Thanks, Namhyung Namhyung Kim (6): perf utils: Add perf_quiet_option() perf utils: Check verbose flag properly perf report: Add -q/--quiet option perf diff: Add -q/--quiet option perf annotate: Add -q/--quiet option perf record: Honor quiet option properly tools/perf/Documentation/perf-annotate.txt | 4 ++++ tools/perf/Documentation/perf-diff.txt | 4 ++++ tools/perf/Documentation/perf-report.txt | 4 ++++ tools/perf/builtin-annotate.c | 4 ++++ tools/perf/builtin-diff.c | 14 ++++++++++---- tools/perf/builtin-record.c | 3 +++ tools/perf/builtin-report.c | 21 ++++++++++++++++----- tools/perf/util/annotate.c | 2 +- tools/perf/util/debug.c | 17 +++++++++++++++++ tools/perf/util/debug.h | 1 + tools/perf/util/dso.c | 2 +- tools/perf/util/hist.c | 6 +++--- tools/perf/util/pmu.c | 8 ++++---- tools/perf/util/sort.c | 8 ++++---- tools/perf/util/symbol-elf.c | 2 +- 15 files changed, 77 insertions(+), 23 deletions(-) -- 2.11.1
[toc] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-17 09:20 +0100 |
| Subject | [PATCH 1/6] perf utils: Add perf_quiet_option() |
| Message-ID | <tbLVM-1GO-19@gated-at.bofh.it> |
| In reply to | #1583187 |
The perf_quiet_option() is to suppress all messages. It's intended to
be called just after parsing options.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/debug.c | 17 +++++++++++++++++
tools/perf/util/debug.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index c1838b643108..03eb81f30d0d 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -203,11 +203,28 @@ int perf_debug_option(const char *str)
v = (v < 0) || (v > 10) ? 0 : v;
}
+ if (quiet)
+ v = -1;
+
*var->ptr = v;
free(s);
return 0;
}
+int perf_quiet_option(void)
+{
+ struct debug_variable *var = &debug_variables[0];
+
+ /* disable all debug messages */
+ while (var->name) {
+ *var->ptr = -1;
+ var++;
+ }
+
+ quiet = true;
+ return 0;
+}
+
#define DEBUG_WRAPPER(__n, __l) \
static int pr_ ## __n ## _wrapper(const char *fmt, ...) \
{ \
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d242adc3d5a2..98832f5531d3 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -54,5 +54,6 @@ int veprintf(int level, int var, const char *fmt, va_list args);
int perf_debug_option(const char *str);
void perf_debug_setup(void);
+int perf_quiet_option(void);
#endif /* __PERF_DEBUG_H */
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2017-02-21 09:20 +0100 |
| Subject | [tip:perf/urgent] perf utils: Add perf_quiet_option() |
| Message-ID | <tddPZ-8nM-37@gated-at.bofh.it> |
| In reply to | #1583188 |
Commit-ID: 80df1988201ac6648609eba13d48aef9f7974c10
Gitweb: http://git.kernel.org/tip/80df1988201ac6648609eba13d48aef9f7974c10
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 17 Feb 2017 17:17:37 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Feb 2017 11:16:32 -0300
perf utils: Add perf_quiet_option()
The perf_quiet_option() is to suppress all messages. It's intended to
be called just after parsing options.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/debug.c | 17 +++++++++++++++++
tools/perf/util/debug.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index c1838b6..03eb81f 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -203,11 +203,28 @@ int perf_debug_option(const char *str)
v = (v < 0) || (v > 10) ? 0 : v;
}
+ if (quiet)
+ v = -1;
+
*var->ptr = v;
free(s);
return 0;
}
+int perf_quiet_option(void)
+{
+ struct debug_variable *var = &debug_variables[0];
+
+ /* disable all debug messages */
+ while (var->name) {
+ *var->ptr = -1;
+ var++;
+ }
+
+ quiet = true;
+ return 0;
+}
+
#define DEBUG_WRAPPER(__n, __l) \
static int pr_ ## __n ## _wrapper(const char *fmt, ...) \
{ \
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d242adc..98832f5 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -54,5 +54,6 @@ int veprintf(int level, int var, const char *fmt, va_list args);
int perf_debug_option(const char *str);
void perf_debug_setup(void);
+int perf_quiet_option(void);
#endif /* __PERF_DEBUG_H */
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-17 09:20 +0100 |
| Subject | [PATCH 4/6] perf diff: Add -q/--quiet option |
| Message-ID | <tbLVM-1GO-23@gated-at.bofh.it> |
| In reply to | #1583187 |
The -q/--quiet option is to suppress any message. Sometimes users just
want to see the numbers and it can be used for that case.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-diff.txt | 4 ++++
tools/perf/builtin-diff.c | 14 ++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 66dbe3dee74b..a79c84ae61aa 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -73,6 +73,10 @@ OPTIONS
Be verbose, for instance, show the raw counts in addition to the
diff.
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-f::
--force::
Don't do ownership validation.
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 70a289347591..1b96a3122228 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -691,7 +691,7 @@ static void hists__process(struct hists *hists)
hists__precompute(hists);
hists__output_resort(hists, NULL);
- hists__fprintf(hists, true, 0, 0, 0, stdout,
+ hists__fprintf(hists, !quiet, 0, 0, 0, stdout,
symbol_conf.use_callchain);
}
@@ -739,12 +739,14 @@ static void data_process(void)
hists__link(hists_base, hists);
}
- fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
- perf_evsel__name(evsel_base));
+ if (!quiet) {
+ fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
+ perf_evsel__name(evsel_base));
+ }
first = false;
- if (verbose || data__files_cnt > 2)
+ if (verbose > 0 || ((data__files_cnt > 2) && !quiet))
data__fprintf();
/* Don't sort callchain for perf diff */
@@ -807,6 +809,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('b', "baseline-only", &show_baseline_only,
"Show only items with match in baseline"),
OPT_CALLBACK('c', "compute", &compute,
@@ -1328,6 +1331,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
argc = parse_options(argc, argv, options, diff_usage, 0);
+ if (quiet)
+ perf_quiet_option();
+
if (symbol__init(NULL) < 0)
return -1;
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2017-02-21 09:20 +0100 |
| Subject | [tip:perf/urgent] perf diff: Add -q/--quiet option |
| Message-ID | <tddPZ-8nM-33@gated-at.bofh.it> |
| In reply to | #1583190 |
Commit-ID: 63b42fce864a468ee02e6647474c4df9bfdc6166
Gitweb: http://git.kernel.org/tip/63b42fce864a468ee02e6647474c4df9bfdc6166
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 17 Feb 2017 17:17:40 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Feb 2017 11:47:08 -0300
perf diff: Add -q/--quiet option
The -q/--quiet option is to suppress any message. Sometimes users just
want to see the numbers and it can be used for that case.
Committer notes:
Before:
# perf diff | head -10
Failed to open /tmp/perf-6678.map, continuing without symbols
Failed to open /tmp/perf-6678.map, continuing without symbols
Failed to open /tmp/perf-2646.map, continuing without symbols
# Event 'cycles'
#
# Baseline Delta Abs Shared Object Symbol
# ........ ......... .......................... ............................................
#
5.36% -1.76% [kernel.vmlinux] [k] intel_idle
2.80% +1.48% firefox [.] 0x00000000000101fe
57.12% -1.25% libxul.so [.] 0x00000000009bea92
1.36% -1.11% [kernel.vmlinux] [k] __schedule
4.26% -1.00% perf-6678.map [.] 0x00007fac4b0e9320
After:
# perf diff -q | head -10
5.36% -1.76% [kernel.vmlinux] [k] intel_idle
2.80% +1.48% firefox [.] 0x00000000000101fe
57.12% -1.25% libxul.so [.] 0x00000000009bea92
1.36% -1.11% [kernel.vmlinux] [k] __schedule
4.26% -1.00% perf-6678.map [.] 0x00007fac4b0e9320
1.86% +0.95% [kernel.vmlinux] [k] update_blocked_averages
0.80% -0.70% [kernel.vmlinux] [k] native_sched_clock
0.74% -0.58% [kernel.vmlinux] [k] native_write_msr
0.76% -0.56% qemu-system-x86_64 [.] 0x00000000002395c0
+0.54% libpulsecommon-10.0.so [.] 0x000000000002d91b
#
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-diff.txt | 4 ++++
tools/perf/builtin-diff.c | 14 ++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 66dbe3de..a79c84a 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -73,6 +73,10 @@ OPTIONS
Be verbose, for instance, show the raw counts in addition to the
diff.
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-f::
--force::
Don't do ownership validation.
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 7ad0d78..1b96a31 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -691,7 +691,7 @@ static void hists__process(struct hists *hists)
hists__precompute(hists);
hists__output_resort(hists, NULL);
- hists__fprintf(hists, true, 0, 0, 0, stdout,
+ hists__fprintf(hists, !quiet, 0, 0, 0, stdout,
symbol_conf.use_callchain);
}
@@ -739,12 +739,14 @@ static void data_process(void)
hists__link(hists_base, hists);
}
- fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
- perf_evsel__name(evsel_base));
+ if (!quiet) {
+ fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
+ perf_evsel__name(evsel_base));
+ }
first = false;
- if (verbose > 0 || data__files_cnt > 2)
+ if (verbose > 0 || ((data__files_cnt > 2) && !quiet))
data__fprintf();
/* Don't sort callchain for perf diff */
@@ -807,6 +809,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('b', "baseline-only", &show_baseline_only,
"Show only items with match in baseline"),
OPT_CALLBACK('c', "compute", &compute,
@@ -1328,6 +1331,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
argc = parse_options(argc, argv, options, diff_usage, 0);
+ if (quiet)
+ perf_quiet_option();
+
if (symbol__init(NULL) < 0)
return -1;
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-17 09:20 +0100 |
| Subject | [PATCH 3/6] perf report: Add -q/--quiet option |
| Message-ID | <tbLVL-1GO-13@gated-at.bofh.it> |
| In reply to | #1583187 |
The -q/--quiet option is to suppress any message. Sometimes users just
want to see the numbers and it can be used for that case.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-report.txt | 4 ++++
tools/perf/builtin-report.c | 21 ++++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index f2914f03ae7b..c04cc0647c16 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -25,6 +25,10 @@ OPTIONS
--verbose::
Be more verbose. (show symbol address, etc)
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-n::
--show-nr-samples::
Show the number of samples for each symbol
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index dbd7fa028861..0a88670e56f3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
size_t size = sizeof(buf);
int socked_id = hists->socket_filter;
+ if (quiet)
+ return 0;
+
if (symbol_conf.filter_relative) {
nr_samples = hists->stats.nr_non_filtered_samples;
nr_events = hists->stats.total_non_filtered_period;
@@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
{
struct perf_evsel *pos;
- fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
+ if (!quiet) {
+ fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
+ evlist->stats.total_lost_samples);
+ }
+
evlist__for_each_entry(evlist, pos) {
struct hists *hists = evsel__hists(pos);
const char *evname = perf_evsel__name(pos);
@@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
continue;
hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
- hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
+ hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
symbol_conf.use_callchain);
fprintf(stdout, "\n\n");
}
@@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
"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('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
@@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
report.symbol_filter_str = argv[0];
}
+ if (quiet)
+ perf_quiet_option();
+
if (symbol_conf.vmlinux_name &&
access(symbol_conf.vmlinux_name, R_OK)) {
pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
@@ -983,14 +994,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
goto error;
}
- if (report.header || report.header_only) {
+ if ((report.header || report.header_only) && !quiet) {
perf_session__fprintf_info(session, stdout,
report.show_full_info);
if (report.header_only) {
ret = 0;
goto error;
}
- } else if (use_browser == 0) {
+ } else if (use_browser == 0 && !quiet) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
}
@@ -1009,7 +1020,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
* providing it only in verbose mode not to bloat too
* much struct symbol.
*/
- if (verbose) {
+ if (verbose > 0) {
/*
* XXX: Need to provide a less kludgy way to ask for
* more space per symbol, the u32 is for the index on
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-02-17 12:20 +0100 |
| Subject | Re: [PATCH 3/6] perf report: Add -q/--quiet option |
| Message-ID | <tbOJX-3B2-1@gated-at.bofh.it> |
| In reply to | #1583191 |
On Fri, Feb 17, 2017 at 05:17:39PM +0900, Namhyung Kim wrote: > The -q/--quiet option is to suppress any message. Sometimes users just > want to see the numbers and it can be used for that case. could you put in some example of the new output? thanks, jirka
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-19 01:40 +0100 |
| Subject | Re: [PATCH 3/6] perf report: Add -q/--quiet option |
| Message-ID | <tcnHI-qy-7@gated-at.bofh.it> |
| In reply to | #1583332 |
Hi Jiri,
On Fri, Feb 17, 2017 at 12:09:35PM +0100, Jiri Olsa wrote:
> On Fri, Feb 17, 2017 at 05:17:39PM +0900, Namhyung Kim wrote:
> > The -q/--quiet option is to suppress any message. Sometimes users just
> > want to see the numbers and it can be used for that case.
>
> could you put in some example of the new output?
Sure.
From bb28410a27be6d6fb15ec4498094301693115f1d Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@kernel.org>
Date: Fri, 17 Feb 2017 16:38:28 +0900
Subject: [PATCH] perf report: Add -q/--quiet option
The -q/--quiet option is to suppress any message. Sometimes users just
want to see the numbers and it can be used for that case.
Before:
$ perf report | head -15
Failed to open /lib/modules/3.19.3-3-ARCH/kernel/fs/ext4/ext4.ko.gz, continuing without symbols
Failed to open /lib/modules/3.19.3-3-ARCH/kernel/fs/jbd2/jbd2.ko.gz, continuing without symbols
Failed to open /tmp/perf-14507.map, continuing without symbols
...
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 39K of event 'cycles'
# Event count (approx.): 30444796573
#
# Overhead Command Shared Object Symbol
# ........ ........... ................... .........................
#
9.28% swapper [kernel.vmlinux] [k] intel_idle
5.64% swapper [kernel.vmlinux] [k] native_write_msr_safe
1.93% swapper [kernel.vmlinux] [k] __switch_to
1.89% swapper [kernel.vmlinux] [k] menu_select
1.75% sched-pipe [kernel.vmlinux] [k] __switch_to
After:
$ perf report -q | head
9.28% swapper [kernel.vmlinux] [k] intel_idle
5.64% swapper [kernel.vmlinux] [k] native_write_msr_safe
1.93% swapper [kernel.vmlinux] [k] __switch_to
1.89% swapper [kernel.vmlinux] [k] menu_select
1.75% sched-pipe [kernel.vmlinux] [k] __switch_to
1.67% swapper [kernel.vmlinux] [k] cpu_startup_entry
1.48% sched-pipe [kernel.vmlinux] [k] enqueue_entity
1.46% swapper [kernel.vmlinux] [k] __schedule
1.36% swapper [kernel.vmlinux] [k] native_read_tsc
1.34% sched-pipe [kernel.vmlinux] [k] __schedule
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-report.txt | 4 ++++
tools/perf/builtin-report.c | 21 ++++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index f2914f03ae7b..c04cc0647c16 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -25,6 +25,10 @@ OPTIONS
--verbose::
Be more verbose. (show symbol address, etc)
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-n::
--show-nr-samples::
Show the number of samples for each symbol
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index dbd7fa028861..0a88670e56f3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
size_t size = sizeof(buf);
int socked_id = hists->socket_filter;
+ if (quiet)
+ return 0;
+
if (symbol_conf.filter_relative) {
nr_samples = hists->stats.nr_non_filtered_samples;
nr_events = hists->stats.total_non_filtered_period;
@@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
{
struct perf_evsel *pos;
- fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
+ if (!quiet) {
+ fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
+ evlist->stats.total_lost_samples);
+ }
+
evlist__for_each_entry(evlist, pos) {
struct hists *hists = evsel__hists(pos);
const char *evname = perf_evsel__name(pos);
@@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
continue;
hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
- hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
+ hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
symbol_conf.use_callchain);
fprintf(stdout, "\n\n");
}
@@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
"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('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
@@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
report.symbol_filter_str = argv[0];
}
+ if (quiet)
+ perf_quiet_option();
+
if (symbol_conf.vmlinux_name &&
access(symbol_conf.vmlinux_name, R_OK)) {
pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
@@ -983,14 +994,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
goto error;
}
- if (report.header || report.header_only) {
+ if ((report.header || report.header_only) && !quiet) {
perf_session__fprintf_info(session, stdout,
report.show_full_info);
if (report.header_only) {
ret = 0;
goto error;
}
- } else if (use_browser == 0) {
+ } else if (use_browser == 0 && !quiet) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
}
@@ -1009,7 +1020,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
* providing it only in verbose mode not to bloat too
* much struct symbol.
*/
- if (verbose) {
+ if (verbose > 0) {
/*
* XXX: Need to provide a less kludgy way to ask for
* more space per symbol, the u32 is for the index on
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2017-02-20 20:10 +0100 |
| Subject | Re: [PATCH 3/6] perf report: Add -q/--quiet option |
| Message-ID | <td1vt-dn-35@gated-at.bofh.it> |
| In reply to | #1583191 |
Em Fri, Feb 17, 2017 at 05:17:39PM +0900, Namhyung Kim escreveu:
> The -q/--quiet option is to suppress any message. Sometimes users just
> want to see the numbers and it can be used for that case.
#
# (Tip: Customize output of perf script with: perf script -F event,ip,sym)
#
(END)
This still appears, at the end :-\
- Arnaldo
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/Documentation/perf-report.txt | 4 ++++
> tools/perf/builtin-report.c | 21 ++++++++++++++++-----
> 2 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index f2914f03ae7b..c04cc0647c16 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -25,6 +25,10 @@ OPTIONS
> --verbose::
> Be more verbose. (show symbol address, etc)
>
> +-q::
> +--quiet::
> + Do not show any message. (Suppress -v)
> +
> -n::
> --show-nr-samples::
> Show the number of samples for each symbol
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index dbd7fa028861..0a88670e56f3 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
> size_t size = sizeof(buf);
> int socked_id = hists->socket_filter;
>
> + if (quiet)
> + return 0;
> +
> if (symbol_conf.filter_relative) {
> nr_samples = hists->stats.nr_non_filtered_samples;
> nr_events = hists->stats.total_non_filtered_period;
> @@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
> {
> struct perf_evsel *pos;
>
> - fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
> + if (!quiet) {
> + fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
> + evlist->stats.total_lost_samples);
> + }
> +
> evlist__for_each_entry(evlist, pos) {
> struct hists *hists = evsel__hists(pos);
> const char *evname = perf_evsel__name(pos);
> @@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
> continue;
>
> hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
> - hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
> + hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
> symbol_conf.use_callchain);
> fprintf(stdout, "\n\n");
> }
> @@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> "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('D', "dump-raw-trace", &dump_trace,
> "dump raw trace in ASCII"),
> OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
> @@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> report.symbol_filter_str = argv[0];
> }
>
> + if (quiet)
> + perf_quiet_option();
> +
> if (symbol_conf.vmlinux_name &&
> access(symbol_conf.vmlinux_name, R_OK)) {
> pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
> @@ -983,14 +994,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> goto error;
> }
>
> - if (report.header || report.header_only) {
> + if ((report.header || report.header_only) && !quiet) {
> perf_session__fprintf_info(session, stdout,
> report.show_full_info);
> if (report.header_only) {
> ret = 0;
> goto error;
> }
> - } else if (use_browser == 0) {
> + } else if (use_browser == 0 && !quiet) {
> fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
> stdout);
> }
> @@ -1009,7 +1020,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> * providing it only in verbose mode not to bloat too
> * much struct symbol.
> */
> - if (verbose) {
> + if (verbose > 0) {
> /*
> * XXX: Need to provide a less kludgy way to ask for
> * more space per symbol, the u32 is for the index on
> --
> 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-21 02:50 +0100 |
| Subject | Re: [PATCH 3/6] perf report: Add -q/--quiet option |
| Message-ID | <td7Kx-43y-5@gated-at.bofh.it> |
| In reply to | #1584838 |
On Mon, Feb 20, 2017 at 04:08:01PM -0300, Arnaldo Carvalho de Melo wrote: > Em Fri, Feb 17, 2017 at 05:17:39PM +0900, Namhyung Kim escreveu: > > The -q/--quiet option is to suppress any message. Sometimes users just > > want to see the numbers and it can be used for that case. > > > > # > # (Tip: Customize output of perf script with: perf script -F event,ip,sym) > # > (END) > > > This still appears, at the end :-\ Ah, right. Will fix. Thanks, Namhyung
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2017-02-21 09:20 +0100 |
| Subject | [tip:perf/urgent] perf report: Add -q/--quiet option |
| Message-ID | <tddPY-8nM-13@gated-at.bofh.it> |
| In reply to | #1583191 |
Commit-ID: 27fafab59a60b6f02491f2ff44cafd4f2335e487
Gitweb: http://git.kernel.org/tip/27fafab59a60b6f02491f2ff44cafd4f2335e487
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 17 Feb 2017 17:17:39 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Feb 2017 11:46:58 -0300
perf report: Add -q/--quiet option
The -q/--quiet option is to suppress any message. Sometimes users just
want to see the numbers and it can be used for that case.
Before:
$ perf report | head -15
Failed to open /lib/modules/3.19.3-3-ARCH/kernel/fs/ext4/ext4.ko.gz, continuing without symbols
Failed to open /lib/modules/3.19.3-3-ARCH/kernel/fs/jbd2/jbd2.ko.gz, continuing without symbols
Failed to open /tmp/perf-14507.map, continuing without symbols
...
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 39K of event 'cycles'
# Event count (approx.): 30444796573
#
# Overhead Command Shared Object Symbol
# ........ ........... ................... .........................
#
9.28% swapper [kernel.vmlinux] [k] intel_idle
5.64% swapper [kernel.vmlinux] [k] native_write_msr_safe
1.93% swapper [kernel.vmlinux] [k] __switch_to
1.89% swapper [kernel.vmlinux] [k] menu_select
1.75% sched-pipe [kernel.vmlinux] [k] __switch_to
After:
$ perf report -q | head
9.28% swapper [kernel.vmlinux] [k] intel_idle
5.64% swapper [kernel.vmlinux] [k] native_write_msr_safe
1.93% swapper [kernel.vmlinux] [k] __switch_to
1.89% swapper [kernel.vmlinux] [k] menu_select
1.75% sched-pipe [kernel.vmlinux] [k] __switch_to
1.67% swapper [kernel.vmlinux] [k] cpu_startup_entry
1.48% sched-pipe [kernel.vmlinux] [k] enqueue_entity
1.46% swapper [kernel.vmlinux] [k] __schedule
1.36% swapper [kernel.vmlinux] [k] native_read_tsc
1.34% sched-pipe [kernel.vmlinux] [k] __schedule
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-4-namhyung@kernel.org
[ Removed builtin-report.c verbose > 0 hunk added to the previous patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 4 ++++
tools/perf/builtin-report.c | 19 +++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index f2914f0..c04cc06 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -25,6 +25,10 @@ OPTIONS
--verbose::
Be more verbose. (show symbol address, etc)
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-n::
--show-nr-samples::
Show the number of samples for each symbol
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index a944881..0a88670 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
size_t size = sizeof(buf);
int socked_id = hists->socket_filter;
+ if (quiet)
+ return 0;
+
if (symbol_conf.filter_relative) {
nr_samples = hists->stats.nr_non_filtered_samples;
nr_events = hists->stats.total_non_filtered_period;
@@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
{
struct perf_evsel *pos;
- fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
+ if (!quiet) {
+ fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
+ evlist->stats.total_lost_samples);
+ }
+
evlist__for_each_entry(evlist, pos) {
struct hists *hists = evsel__hists(pos);
const char *evname = perf_evsel__name(pos);
@@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
continue;
hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
- hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
+ hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
symbol_conf.use_callchain);
fprintf(stdout, "\n\n");
}
@@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
"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('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
@@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
report.symbol_filter_str = argv[0];
}
+ if (quiet)
+ perf_quiet_option();
+
if (symbol_conf.vmlinux_name &&
access(symbol_conf.vmlinux_name, R_OK)) {
pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
@@ -983,14 +994,14 @@ repeat:
goto error;
}
- if (report.header || report.header_only) {
+ if ((report.header || report.header_only) && !quiet) {
perf_session__fprintf_info(session, stdout,
report.show_full_info);
if (report.header_only) {
ret = 0;
goto error;
}
- } else if (use_browser == 0) {
+ } else if (use_browser == 0 && !quiet) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
}
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-02-17 09:20 +0100 |
| Subject | [PATCH 6/6] perf record: Honor quiet option properly |
| Message-ID | <tbLVM-1GO-17@gated-at.bofh.it> |
| In reply to | #1583187 |
It should call perf_quiet_option() to suppress messages. Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/builtin-record.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 6cd6776052e7..47ca5ff02c35 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1677,6 +1677,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) argc = parse_options(argc, argv, record_options, record_usage, PARSE_OPT_STOP_AT_NON_OPTION); + if (quiet) + perf_quiet_option(); + if (!argc && target__none(&rec->opts.target)) usage_with_options(record_usage, record_options); -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2017-02-21 09:20 +0100 |
| Subject | [tip:perf/urgent] perf record: Honor --quiet option properly |
| Message-ID | <tddPY-8nM-7@gated-at.bofh.it> |
| In reply to | #1583192 |
Commit-ID: 68ba32352d51474d163d58e084b62a12bb610b21
Gitweb: http://git.kernel.org/tip/68ba32352d51474d163d58e084b62a12bb610b21
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 17 Feb 2017 17:17:42 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Feb 2017 11:50:36 -0300
perf record: Honor --quiet option properly
It should call perf_quiet_option() to suppress messages.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-7-namhyung@kernel.org
[ Fix merge clash with 483635a9d080 ("perf record: Add -a as default target") ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 451b11e..bc84a37 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1677,6 +1677,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
argc = parse_options(argc, argv, record_options, record_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (quiet)
+ perf_quiet_option();
/* Make system wide (-a) the default target. */
if (!argc && target__none(&rec->opts.target))
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web