diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-12-09 05:02:50 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-10 14:51:07 -0500 |
commit | e90debddf8f26094cd90162b9af2a8ed37ed57cb (patch) | |
tree | e4c82c07d1df9430180f7dc0e8455797be08a3a6 /tools/perf | |
parent | 5cfe2c82f3eb6876cf4b55e99decea0bd015d6b8 (diff) |
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-script.txt | 6 | ||||
-rw-r--r-- | 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 c2a5071cf8f8..05f9a0a6784c 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt | |||
@@ -209,6 +209,12 @@ OPTIONS | |||
209 | --show-mmap-events | 209 | --show-mmap-events |
210 | Display mmap related events (e.g. MMAP, MMAP2). | 210 | Display mmap related events (e.g. MMAP, MMAP2). |
211 | 211 | ||
212 | --header | ||
213 | Show perf.data header. | ||
214 | |||
215 | --header-only | ||
216 | Show only perf.data header. | ||
217 | |||
212 | SEE ALSO | 218 | SEE ALSO |
213 | -------- | 219 | -------- |
214 | linkperf:perf-record[1], linkperf:perf-script-perl[1], | 220 | linkperf:perf-record[1], linkperf:perf-script-perl[1], |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 7a571fb7eb8a..f8ab125aac48 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) | |||
1494 | int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | 1494 | int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) |
1495 | { | 1495 | { |
1496 | bool show_full_info = false; | 1496 | bool show_full_info = false; |
1497 | bool header = false; | ||
1498 | bool header_only = false; | ||
1497 | char *rec_script_path = NULL; | 1499 | char *rec_script_path = NULL; |
1498 | char *rep_script_path = NULL; | 1500 | char *rep_script_path = NULL; |
1499 | struct perf_session *session; | 1501 | struct perf_session *session; |
@@ -1532,6 +1534,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1532 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 1534 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
1533 | OPT_BOOLEAN('d', "debug-mode", &debug_mode, | 1535 | OPT_BOOLEAN('d', "debug-mode", &debug_mode, |
1534 | "do various checks like samples ordering and lost events"), | 1536 | "do various checks like samples ordering and lost events"), |
1537 | OPT_BOOLEAN(0, "header", &header, "Show data header."), | ||
1538 | OPT_BOOLEAN(0, "header-only", &header_only, "Show only data header."), | ||
1535 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | 1539 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, |
1536 | "file", "vmlinux pathname"), | 1540 | "file", "vmlinux pathname"), |
1537 | OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, | 1541 | 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) | |||
1748 | if (session == NULL) | 1752 | if (session == NULL) |
1749 | return -ENOMEM; | 1753 | return -ENOMEM; |
1750 | 1754 | ||
1755 | if (header || header_only) { | ||
1756 | perf_session__fprintf_info(session, stdout, show_full_info); | ||
1757 | if (header_only) | ||
1758 | return 0; | ||
1759 | } | ||
1760 | |||
1751 | script.session = session; | 1761 | script.session = session; |
1752 | 1762 | ||
1753 | if (cpu_list) { | 1763 | if (cpu_list) { |
@@ -1755,9 +1765,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1755 | return -1; | 1765 | return -1; |
1756 | } | 1766 | } |
1757 | 1767 | ||
1758 | if (!script_name && !generate_script_lang) | ||
1759 | perf_session__fprintf_info(session, stdout, show_full_info); | ||
1760 | |||
1761 | if (!no_callchain) | 1768 | if (!no_callchain) |
1762 | symbol_conf.use_callchain = true; | 1769 | symbol_conf.use_callchain = true; |
1763 | else | 1770 | else |