* [PATCH 0/2] perf tools: Add --header/--header-only options
@ 2013-12-09 10:02 Jiri Olsa
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Jiri Olsa @ 2013-12-09 10:02 UTC (permalink / raw)
To: linux-kernel
Cc: Corey Ashford, Frederic Weisbecker, Ingo Molnar, Namhyung Kim,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
David Ahern
Currently the perf.data header is always displayed for stdio
output, which is no always useful.
Disabling header information by default and adding following
options to control header output:
--header - display header information (old default)
--header-only - display header information only w/o further
processing.
thanks,
jirka
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: David Ahern <dsahern@gmail.com>
---
tools/perf/Documentation/perf-report.txt | 6 ++++++
tools/perf/Documentation/perf-script.txt | 6 ++++++
tools/perf/builtin-report.c | 19 ++++++++++++++++---
tools/perf/builtin-script.c | 13 ++++++++++---
4 files changed, 38 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] perf report: Add --header/--header-only options
2013-12-09 10:02 [PATCH 0/2] perf tools: Add --header/--header-only options Jiri Olsa
@ 2013-12-09 10:02 ` Jiri Olsa
2013-12-10 0:12 ` Namhyung Kim
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-09 10:02 ` [PATCH 2/2] perf script: " Jiri Olsa
` (2 subsequent siblings)
3 siblings, 2 replies; 11+ messages in thread
From: Jiri Olsa @ 2013-12-09 10:02 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Namhyung Kim, Paul Mackerras, Peter Zijlstra,
Arnaldo Carvalho de Melo, David Ahern
Currently the perf.data header is always displayed for stdio
output, which is no always useful.
Disabling header information by default and adding following
options to control header output:
--header - display header information (old default)
--header-only - display header information only w/o further
processing, forces stdio output
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: David Ahern <dsahern@gmail.com>
---
tools/perf/Documentation/perf-report.txt | 6 ++++++
tools/perf/builtin-report.c | 19 ++++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 10a2798..e41cbfb 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -237,6 +237,12 @@ OPTIONS
Do not show entries which have an overhead under that percent.
(Default: 0).
+--header
+ Show perf.data header.
+
+--header-only
+ Show only perf.data header (forces --stdio).
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-annotate[1]
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8cf8e66..242fd6f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -49,6 +49,8 @@ struct perf_report {
bool show_threads;
bool inverted_callchain;
bool mem_mode;
+ bool header;
+ bool header_only;
int max_stack;
struct perf_read_values show_threads_values;
const char *pretty_printing_style;
@@ -514,9 +516,6 @@ static int __cmd_report(struct perf_report *rep)
return ret;
}
- if (use_browser <= 0)
- perf_session__fprintf_info(session, stdout, rep->show_full_info);
-
if (rep->show_threads)
perf_read_values_init(&rep->show_threads_values);
@@ -820,6 +819,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"),
OPT_BOOLEAN(0, "stdio", &report.use_stdio,
"Use the stdio interface"),
+ OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &report.header_only,
+ "Show only data header."),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline,"
" dso_to, dso_from, symbol_to, symbol_from, mispredict,"
@@ -963,6 +965,10 @@ repeat:
goto error;
}
+ /* Force tty output for header output. */
+ if (report.header || report.header_only)
+ use_browser = 0;
+
if (strcmp(input_name, "-") != 0)
setup_browser(true);
else {
@@ -970,6 +976,13 @@ repeat:
perf_hpp__init();
}
+ if (report.header || report.header_only) {
+ perf_session__fprintf_info(session, stdout,
+ report.show_full_info);
+ if (report.header_only)
+ return 0;
+ }
+
/*
* Only in the TUI browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio
--
1.8.3.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] perf script: Add --header/--header-only options
2013-12-09 10:02 [PATCH 0/2] perf tools: Add --header/--header-only options Jiri Olsa
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
@ 2013-12-09 10:02 ` Jiri Olsa
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-09 23:25 ` [PATCH 0/2] perf tools: " David Ahern
2013-12-10 0:06 ` Namhyung Kim
3 siblings, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2013-12-09 10:02 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Namhyung Kim, Paul Mackerras, Peter Zijlstra,
Arnaldo Carvalho de Melo, David Ahern
Currently the perf.data header is always displayed for stdio
output, which is no always useful.
Disabling header information by default and adding following
options to control header output:
--header - display header information
--header-only - display header information only w/o further
processing
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: David Ahern <dsahern@gmail.com>
---
tools/perf/Documentation/perf-script.txt | 6 ++++++
tools/perf/builtin-script.c | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index cfdbb1e..ab3ce09 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -209,6 +209,12 @@ OPTIONS
--show-mmap-events
Display mmap related events (e.g. MMAP, MMAP2).
+--header
+ Show perf.data header.
+
+--header-only
+ Show only perf.data header.
+
SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 4484886..495b3b8 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1484,6 +1484,8 @@ static int have_cmd(int argc, const char **argv)
int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
{
bool show_full_info = false;
+ bool header = false;
+ bool header_only = false;
char *rec_script_path = NULL;
char *rep_script_path = NULL;
struct perf_session *session;
@@ -1522,6 +1524,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_BOOLEAN('d', "debug-mode", &debug_mode,
"do various checks like samples ordering and lost events"),
+ OPT_BOOLEAN(0, "header", &header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &header_only, "Show only data header."),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
@@ -1738,6 +1742,12 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
if (session == NULL)
return -ENOMEM;
+ if (header || header_only) {
+ perf_session__fprintf_info(session, stdout, show_full_info);
+ if (header_only)
+ return 0;
+ }
+
script.session = session;
if (cpu_list) {
@@ -1745,9 +1755,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
return -1;
}
- if (!script_name && !generate_script_lang)
- perf_session__fprintf_info(session, stdout, show_full_info);
-
if (!no_callchain)
symbol_conf.use_callchain = true;
else
--
1.8.3.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] perf tools: Add --header/--header-only options
2013-12-09 10:02 [PATCH 0/2] perf tools: Add --header/--header-only options Jiri Olsa
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
2013-12-09 10:02 ` [PATCH 2/2] perf script: " Jiri Olsa
@ 2013-12-09 23:25 ` David Ahern
2013-12-10 11:42 ` Arnaldo Carvalho de Melo
2013-12-10 0:06 ` Namhyung Kim
3 siblings, 1 reply; 11+ messages in thread
From: David Ahern @ 2013-12-09 23:25 UTC (permalink / raw)
To: Jiri Olsa, linux-kernel
Cc: Corey Ashford, Frederic Weisbecker, Ingo Molnar, Namhyung Kim,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
Stephane Eranian
[Added Stephane given that he added the header output]
On 12/9/13, 3:02 AM, Jiri Olsa wrote:
> Currently the perf.data header is always displayed for stdio
> output, which is no always useful.
>
> Disabling header information by default and adding following
> options to control header output:
> --header - display header information (old default)
> --header-only - display header information only w/o further
> processing.
>
> thanks,
> jirka
>
>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: David Ahern <dsahern@gmail.com>
> ---
> tools/perf/Documentation/perf-report.txt | 6 ++++++
> tools/perf/Documentation/perf-script.txt | 6 ++++++
> tools/perf/builtin-report.c | 19 ++++++++++++++++---
> tools/perf/builtin-script.c | 13 ++++++++++---
> 4 files changed, 38 insertions(+), 6 deletions(-)
>
I've been getting annoyed but that as well. Very useful on the first
run; overhead after that.
Acked-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] perf tools: Add --header/--header-only options
2013-12-09 10:02 [PATCH 0/2] perf tools: Add --header/--header-only options Jiri Olsa
` (2 preceding siblings ...)
2013-12-09 23:25 ` [PATCH 0/2] perf tools: " David Ahern
@ 2013-12-10 0:06 ` Namhyung Kim
2013-12-10 10:11 ` Jiri Olsa
3 siblings, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2013-12-10 0:06 UTC (permalink / raw)
To: Jiri Olsa
Cc: linux-kernel, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
David Ahern
Hi Jiri,
On Mon, 9 Dec 2013 11:02:48 +0100, Jiri Olsa wrote:
> Currently the perf.data header is always displayed for stdio
> output, which is no always useful.
>
> Disabling header information by default and adding following
> options to control header output:
Hmm.. I'm not sure it's OK to change the user-visible default behavior.
At least we can provide help message for old users?
Thanks,
Namhyung
> --header - display header information (old default)
> --header-only - display header information only w/o further
> processing.
>
> thanks,
> jirka
>
>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: David Ahern <dsahern@gmail.com>
> ---
> tools/perf/Documentation/perf-report.txt | 6 ++++++
> tools/perf/Documentation/perf-script.txt | 6 ++++++
> tools/perf/builtin-report.c | 19 ++++++++++++++++---
> tools/perf/builtin-script.c | 13 ++++++++++---
> 4 files changed, 38 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf report: Add --header/--header-only options
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
@ 2013-12-10 0:12 ` Namhyung Kim
2013-12-10 10:12 ` Jiri Olsa
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Jiri Olsa
1 sibling, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2013-12-10 0:12 UTC (permalink / raw)
To: Jiri Olsa
Cc: linux-kernel, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
David Ahern
On Mon, 9 Dec 2013 11:02:49 +0100, Jiri Olsa wrote:
> Currently the perf.data header is always displayed for stdio
> output, which is no always useful.
>
> Disabling header information by default and adding following
> options to control header output:
> --header - display header information (old default)
> --header-only - display header information only w/o further
> processing, forces stdio output
>
[SNIP]
> +--header
> + Show perf.data header.
This explanation looks too terse. How about this?
Show header information in the perf.data file. This includes
various information like hostname, os and perf version, cpu/mem
info, perf command line, event list and so on. Currently only
--stdio output supports this feature.
Thanks,
Namhyung
> +
> +--header-only
> + Show only perf.data header (forces --stdio).
> +
> SEE ALSO
> --------
> linkperf:perf-stat[1], linkperf:perf-annotate[1]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] perf tools: Add --header/--header-only options
2013-12-10 0:06 ` Namhyung Kim
@ 2013-12-10 10:11 ` Jiri Olsa
0 siblings, 0 replies; 11+ messages in thread
From: Jiri Olsa @ 2013-12-10 10:11 UTC (permalink / raw)
To: Namhyung Kim
Cc: linux-kernel, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
David Ahern
On Tue, Dec 10, 2013 at 09:06:53AM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> On Mon, 9 Dec 2013 11:02:48 +0100, Jiri Olsa wrote:
> > Currently the perf.data header is always displayed for stdio
> > output, which is no always useful.
> >
> > Disabling header information by default and adding following
> > options to control header output:
>
> Hmm.. I'm not sure it's OK to change the user-visible default behavior.
> At least we can provide help message for old users?
maybe we could display on the first line something like:
$ perf report --stdio
# To display data file header, please use --header/--header-only options.
#
# Samples: 12 of event 'cycles'
# Event count (approx.): 3741156
#
# Overhead Command Shared Object Symbol
# ........ ....... ................. .........................
...
jirka
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf report: Add --header/--header-only options
2013-12-10 0:12 ` Namhyung Kim
@ 2013-12-10 10:12 ` Jiri Olsa
0 siblings, 0 replies; 11+ messages in thread
From: Jiri Olsa @ 2013-12-10 10:12 UTC (permalink / raw)
To: Namhyung Kim
Cc: linux-kernel, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo,
David Ahern
On Tue, Dec 10, 2013 at 09:12:10AM +0900, Namhyung Kim wrote:
> On Mon, 9 Dec 2013 11:02:49 +0100, Jiri Olsa wrote:
> > Currently the perf.data header is always displayed for stdio
> > output, which is no always useful.
> >
> > Disabling header information by default and adding following
> > options to control header output:
> > --header - display header information (old default)
> > --header-only - display header information only w/o further
> > processing, forces stdio output
> >
> [SNIP]
> > +--header
> > + Show perf.data header.
>
> This explanation looks too terse. How about this?
>
> Show header information in the perf.data file. This includes
> various information like hostname, os and perf version, cpu/mem
> info, perf command line, event list and so on. Currently only
> --stdio output supports this feature.
sounds good, I will use it
thanks,
jirka
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] perf tools: Add --header/--header-only options
2013-12-09 23:25 ` [PATCH 0/2] perf tools: " David Ahern
@ 2013-12-10 11:42 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 11:42 UTC (permalink / raw)
To: David Ahern
Cc: Jiri Olsa, linux-kernel, Corey Ashford, Frederic Weisbecker,
Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
Stephane Eranian
Em Mon, Dec 09, 2013 at 04:25:29PM -0700, David Ahern escreveu:
> [Added Stephane given that he added the header output]
Yeah, I added him to the CC list in the patch when I merged it, Ingo had
asked me to do this quite some time ago, I also usually did:
$ perf report | grep -v ^#
When looking for the first few entries in a profile.
I think that with Namhyung's improvement to the man page + the single
line stating that --header should be used to get the previous behavior
we are ok, no?
> On 12/9/13, 3:02 AM, Jiri Olsa wrote:
> >Currently the perf.data header is always displayed for stdio
> >output, which is no always useful.
> >Disabling header information by default and adding following
> >options to control header output:
> > --header - display header information (old default)
> > --header-only - display header information only w/o further
> > processing.
> I've been getting annoyed but that as well. Very useful on the first
> run; overhead after that.
> Acked-by: David Ahern <dsahern@gmail.com>
I'll add this since I'll have to reprocess the last batch due to the
dso__delete problem.
- Arnaldo
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:perf/core] perf report: Add --header/--header-only options
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
2013-12-10 0:12 ` Namhyung Kim
@ 2013-12-11 11:06 ` tip-bot for Jiri Olsa
1 sibling, 0 replies; 11+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-12-11 11:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, eranian, paulus, hpa, mingo, a.p.zijlstra,
namhyung, jolsa, fweisbec, dsahern, tglx, cjashfor, mingo
Commit-ID: 5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8
Gitweb: http://git.kernel.org/tip/5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 9 Dec 2013 11:02:49 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Dec 2013 16:49:02 -0300
perf report: Add --header/--header-only options
Currently the perf.data header is always displayed for stdio output,
which is no always useful.
Disabling header information by default and adding following options to
control header output:
--header - display header information (old default)
--header-only - display header information only w/o further
processing, forces stdio output
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386583370-1699-2-git-send-email-jolsa@redhat.com
[ Added single line explaining talking about the new --header* options,
to address David Ahern comment; better man page entry for the new options,
from Namhyung Kim ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 9 +++++++++
tools/perf/builtin-report.c | 22 +++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 10a2798..8eab8a4 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -237,6 +237,15 @@ OPTIONS
Do not show entries which have an overhead under that percent.
(Default: 0).
+--header::
+ Show header information in the perf.data file. This includes
+ various information like hostname, OS and perf version, cpu/mem
+ info, perf command line, event list and so on. Currently only
+ --stdio output supports this feature.
+
+--header-only::
+ Show only perf.data header (forces --stdio).
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-annotate[1]
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8cf8e66..3a14dbe 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -49,6 +49,8 @@ struct perf_report {
bool show_threads;
bool inverted_callchain;
bool mem_mode;
+ bool header;
+ bool header_only;
int max_stack;
struct perf_read_values show_threads_values;
const char *pretty_printing_style;
@@ -514,9 +516,6 @@ static int __cmd_report(struct perf_report *rep)
return ret;
}
- if (use_browser <= 0)
- perf_session__fprintf_info(session, stdout, rep->show_full_info);
-
if (rep->show_threads)
perf_read_values_init(&rep->show_threads_values);
@@ -820,6 +819,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"),
OPT_BOOLEAN(0, "stdio", &report.use_stdio,
"Use the stdio interface"),
+ OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &report.header_only,
+ "Show only data header."),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline,"
" dso_to, dso_from, symbol_to, symbol_from, mispredict,"
@@ -963,6 +965,10 @@ repeat:
goto error;
}
+ /* Force tty output for header output. */
+ if (report.header || report.header_only)
+ use_browser = 0;
+
if (strcmp(input_name, "-") != 0)
setup_browser(true);
else {
@@ -970,6 +976,16 @@ repeat:
perf_hpp__init();
}
+ if (report.header || report.header_only) {
+ perf_session__fprintf_info(session, stdout,
+ report.show_full_info);
+ if (report.header_only)
+ return 0;
+ } else if (use_browser == 0) {
+ fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
+ stdout);
+ }
+
/*
* Only in the TUI browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [tip:perf/core] perf script: Add --header/--header-only options
2013-12-09 10:02 ` [PATCH 2/2] perf script: " Jiri Olsa
@ 2013-12-11 11:06 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-12-11 11:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, eranian, paulus, linux-kernel, hpa, mingo, a.p.zijlstra,
namhyung, jolsa, fweisbec, dsahern, tglx, cjashfor, mingo
Commit-ID: e90debddf8f26094cd90162b9af2a8ed37ed57cb
Gitweb: http://git.kernel.org/tip/e90debddf8f26094cd90162b9af2a8ed37ed57cb
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 9 Dec 2013 11:02:50 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Dec 2013 16:51:07 -0300
perf script: Add --header/--header-only options
Currently the perf.data header is always displayed for stdio output,
which is no always useful.
Disabling header information by default and adding following options to
control header output:
--header - display header information
--header-only - display header information only w/o further
processing
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-0ehaawv5xc83w6ag03c5hi10@git.kernel.org
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386583370-1699-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script.txt | 6 ++++++
tools/perf/builtin-script.c | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index c2a5071..05f9a0a 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -209,6 +209,12 @@ OPTIONS
--show-mmap-events
Display mmap related events (e.g. MMAP, MMAP2).
+--header
+ Show perf.data header.
+
+--header-only
+ Show only perf.data header.
+
SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7a571fb..f8ab125 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1494,6 +1494,8 @@ static int have_cmd(int argc, const char **argv)
int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
{
bool show_full_info = false;
+ bool header = false;
+ bool header_only = false;
char *rec_script_path = NULL;
char *rep_script_path = NULL;
struct perf_session *session;
@@ -1532,6 +1534,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_BOOLEAN('d', "debug-mode", &debug_mode,
"do various checks like samples ordering and lost events"),
+ OPT_BOOLEAN(0, "header", &header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &header_only, "Show only data header."),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
@@ -1748,6 +1752,12 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
if (session == NULL)
return -ENOMEM;
+ if (header || header_only) {
+ perf_session__fprintf_info(session, stdout, show_full_info);
+ if (header_only)
+ return 0;
+ }
+
script.session = session;
if (cpu_list) {
@@ -1755,9 +1765,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
return -1;
}
- if (!script_name && !generate_script_lang)
- perf_session__fprintf_info(session, stdout, show_full_info);
-
if (!no_callchain)
symbol_conf.use_callchain = true;
else
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-12-11 11:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 10:02 [PATCH 0/2] perf tools: Add --header/--header-only options Jiri Olsa
2013-12-09 10:02 ` [PATCH 1/2] perf report: " Jiri Olsa
2013-12-10 0:12 ` Namhyung Kim
2013-12-10 10:12 ` Jiri Olsa
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-09 10:02 ` [PATCH 2/2] perf script: " Jiri Olsa
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-12-09 23:25 ` [PATCH 0/2] perf tools: " David Ahern
2013-12-10 11:42 ` Arnaldo Carvalho de Melo
2013-12-10 0:06 ` Namhyung Kim
2013-12-10 10:11 ` Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox