perf tools: Add --header/--header-only options
cover perf tools: 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.
thanks,
jirka
--- 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(-)
PATCH 1/2 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
--- tools/perf/Documentation/perf-report.txt | 6 ++++++ tools/perf/builtin-report.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-report.txt +6 -0
@@ -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]
tools/perf/builtin-report.c +16 -3
@@ -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
Signature · 1 line
1.8.3.1
Namhyung Kim
maintainerRe: [PATCH 1/2] perf report: Add --header/--header-only options
Quoted 9 lines · Jiri Olsa
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]
tools/perf/Documentation/perf-report.txt OPTIONS · line 241
Quoted 2 lines
+--header
tools/perf/Documentation/perf-report.txt +1
-0+ 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
Quoted 7 lines
tools/perf/Documentation/perf-report.txt +4
-0+ +--header-only + Show only perf.data header (forces --stdio). + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-annotate[1]
Re: [PATCH 1/2] perf report: Add --header/--header-only options
Quoted 16 lines · Namhyung Kim
Quoted 9 lines · Jiri Olsa
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]
tools/perf/Documentation/perf-report.txt OPTIONS · line 241
Quoted 2 lines
+--header
tools/perf/Documentation/perf-report.txt +1
-0+ Show perf.data header.This explanation looks too terse. How about this?
Quoted 4 lines
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
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf report: Add --header/--header-only options
In reply to Jiri Olsaperf report: Add --header/--header-only options
Commit-ID: 5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8 Gitweb: http://git.kernel.org/tip/5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 9 Dec 2013 11:02:49 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> 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
[ 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 ]
--- tools/perf/Documentation/perf-report.txt | 9 +++++++++ tools/perf/builtin-report.c | 22 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-report.txt +9 -0
@@ -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]
tools/perf/builtin-report.c +19 -3
@@ -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
PATCH 2/2 perf script: Add --header/--header-only options
In reply to Jiri OlsaCurrently 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
--- tools/perf/Documentation/perf-script.txt | 6 ++++++ tools/perf/builtin-script.c | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script.txt +6 -0
@@ -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],
tools/perf/builtin-script.c +10 -3
@@ -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
Signature · 1 line
1.8.3.1
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf script: Add --header/--header-only options
perf script: Add --header/--header-only options
Commit-ID: e90debddf8f26094cd90162b9af2a8ed37ed57cb Gitweb: http://git.kernel.org/tip/e90debddf8f26094cd90162b9af2a8ed37ed57cb Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 9 Dec 2013 11:02:50 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> 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
--- tools/perf/Documentation/perf-script.txt | 6 ++++++ tools/perf/builtin-script.c | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script.txt +6 -0
@@ -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],
tools/perf/builtin-script.c +10 -3
@@ -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
[Added Stephane given that he added the header output]
Quoted 21 lines · Jiri Olsa
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,
jirkaCc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>
Quoted 7 lines
--- 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.
Em Mon, Dec 09, 2013 at 04:25:29PM -0700, David Ahern escreveu:
Quoted 1 line
[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?
Quoted 10 lines · Jiri Olsa
Quoted 8 lines
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.
Quoted 4 lines
I've been getting annoyed but that as well. Very useful on the first run; overhead after that.
Acked-by David Ahern <[email protected]>
I'll add this since I'll have to reprocess the last batch due to the dso__delete problem.
- Arnaldo
Namhyung Kim
maintainerHi Jiri,
Quoted 5 lines · Jiri Olsa
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
Quoted 22 lines
--header - display header information (old default)
--header-only - display header information only w/o further
processing.thanks,
jirkaCc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- 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(-)
Quoted 11 lines · Namhyung Kim
Hi Jiri,
Quoted 5 lines · Jiri Olsa
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