summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-12-09 11:02:49 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-10 16:49:02 -0300
commit5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8 (patch)
treeacef2914b3851c8f137c0b827bf308b61c565364 /tools/perf/builtin-report.c
parent7ef2e813476273ac9c9138f002d8f4cb28e5adad (diff)
downloadop-kernel-dev-5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8.zip
op-kernel-dev-5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8.tar.gz
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>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c22
1 files changed, 19 insertions, 3 deletions
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
OpenPOWER on IntegriCloud