diff options
| author | Jiri Olsa <jolsa@redhat.com> | 2013-12-09 05:02:49 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-10 14:49:02 -0500 |
| commit | 5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8 (patch) | |
| tree | acef2914b3851c8f137c0b827bf308b61c565364 /tools/perf | |
| parent | 7ef2e813476273ac9c9138f002d8f4cb28e5adad (diff) | |
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')
| -rw-r--r-- | tools/perf/Documentation/perf-report.txt | 9 | ||||
| -rw-r--r-- | 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 10a279871251..8eab8a4bdeb8 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
| @@ -237,6 +237,15 @@ OPTIONS | |||
| 237 | Do not show entries which have an overhead under that percent. | 237 | Do not show entries which have an overhead under that percent. |
| 238 | (Default: 0). | 238 | (Default: 0). |
| 239 | 239 | ||
| 240 | --header:: | ||
| 241 | Show header information in the perf.data file. This includes | ||
| 242 | various information like hostname, OS and perf version, cpu/mem | ||
| 243 | info, perf command line, event list and so on. Currently only | ||
| 244 | --stdio output supports this feature. | ||
| 245 | |||
| 246 | --header-only:: | ||
| 247 | Show only perf.data header (forces --stdio). | ||
| 248 | |||
| 240 | SEE ALSO | 249 | SEE ALSO |
| 241 | -------- | 250 | -------- |
| 242 | linkperf:perf-stat[1], linkperf:perf-annotate[1] | 251 | linkperf:perf-stat[1], linkperf:perf-annotate[1] |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 8cf8e66ba594..3a14dbed387c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -49,6 +49,8 @@ struct perf_report { | |||
| 49 | bool show_threads; | 49 | bool show_threads; |
| 50 | bool inverted_callchain; | 50 | bool inverted_callchain; |
| 51 | bool mem_mode; | 51 | bool mem_mode; |
| 52 | bool header; | ||
| 53 | bool header_only; | ||
| 52 | int max_stack; | 54 | int max_stack; |
| 53 | struct perf_read_values show_threads_values; | 55 | struct perf_read_values show_threads_values; |
| 54 | const char *pretty_printing_style; | 56 | const char *pretty_printing_style; |
| @@ -514,9 +516,6 @@ static int __cmd_report(struct perf_report *rep) | |||
| 514 | return ret; | 516 | return ret; |
| 515 | } | 517 | } |
| 516 | 518 | ||
| 517 | if (use_browser <= 0) | ||
| 518 | perf_session__fprintf_info(session, stdout, rep->show_full_info); | ||
| 519 | |||
| 520 | if (rep->show_threads) | 519 | if (rep->show_threads) |
| 521 | perf_read_values_init(&rep->show_threads_values); | 520 | perf_read_values_init(&rep->show_threads_values); |
| 522 | 521 | ||
| @@ -820,6 +819,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 820 | OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"), | 819 | OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"), |
| 821 | OPT_BOOLEAN(0, "stdio", &report.use_stdio, | 820 | OPT_BOOLEAN(0, "stdio", &report.use_stdio, |
| 822 | "Use the stdio interface"), | 821 | "Use the stdio interface"), |
| 822 | OPT_BOOLEAN(0, "header", &report.header, "Show data header."), | ||
| 823 | OPT_BOOLEAN(0, "header-only", &report.header_only, | ||
| 824 | "Show only data header."), | ||
| 823 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 825 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
| 824 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline," | 826 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline," |
| 825 | " dso_to, dso_from, symbol_to, symbol_from, mispredict," | 827 | " dso_to, dso_from, symbol_to, symbol_from, mispredict," |
| @@ -963,6 +965,10 @@ repeat: | |||
| 963 | goto error; | 965 | goto error; |
| 964 | } | 966 | } |
| 965 | 967 | ||
| 968 | /* Force tty output for header output. */ | ||
| 969 | if (report.header || report.header_only) | ||
| 970 | use_browser = 0; | ||
| 971 | |||
| 966 | if (strcmp(input_name, "-") != 0) | 972 | if (strcmp(input_name, "-") != 0) |
| 967 | setup_browser(true); | 973 | setup_browser(true); |
| 968 | else { | 974 | else { |
| @@ -970,6 +976,16 @@ repeat: | |||
| 970 | perf_hpp__init(); | 976 | perf_hpp__init(); |
| 971 | } | 977 | } |
| 972 | 978 | ||
| 979 | if (report.header || report.header_only) { | ||
| 980 | perf_session__fprintf_info(session, stdout, | ||
| 981 | report.show_full_info); | ||
| 982 | if (report.header_only) | ||
| 983 | return 0; | ||
| 984 | } else if (use_browser == 0) { | ||
| 985 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", | ||
| 986 | stdout); | ||
| 987 | } | ||
| 988 | |||
| 973 | /* | 989 | /* |
| 974 | * Only in the TUI browser we are doing integrated annotation, | 990 | * Only in the TUI browser we are doing integrated annotation, |
| 975 | * so don't allocate extra space that won't be used in the stdio | 991 | * so don't allocate extra space that won't be used in the stdio |
