diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2015-04-09 11:53:56 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-04-29 09:37:56 -0400 |
commit | 7a680eb990b6646ecadf22dca7ded16a33f731b9 (patch) | |
tree | 3ea64c55f1d373436f93ac8311c4597ccfdc5e33 | |
parent | cfe9174fcfe28f0f73dce422e3151991ee0d49bf (diff) |
perf script: Add Instruction Tracing support
Add support for decoding an AUX area assuming it contains instruction
tracing data.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1428594864-29309-17-git-send-email-adrian.hunter@intel.com
[ Do not use -Z as an alternative to --itrace ]
[ Fixed initialization of itrace_synth_opts struct fields on older gcc versions ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-script.txt | 27 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 11 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index 79445750fcb3..05df64804def 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt | |||
@@ -221,6 +221,33 @@ OPTIONS | |||
221 | --header-only | 221 | --header-only |
222 | Show only perf.data header. | 222 | Show only perf.data header. |
223 | 223 | ||
224 | --itrace:: | ||
225 | Options for decoding instruction tracing data. The options are: | ||
226 | |||
227 | i synthesize instructions events | ||
228 | b synthesize branches events | ||
229 | c synthesize branches events (calls only) | ||
230 | r synthesize branches events (returns only) | ||
231 | e synthesize error events | ||
232 | d create a debug log | ||
233 | g synthesize a call chain for instructions events | ||
234 | |||
235 | The default is all events i.e. the same as --itrace=ibe | ||
236 | |||
237 | In addition, the period (default 100000) for instructions events | ||
238 | can be specified in units of: | ||
239 | |||
240 | i instructions | ||
241 | t ticks | ||
242 | ms milliseconds | ||
243 | us microseconds | ||
244 | ns nanoseconds (default) | ||
245 | |||
246 | Also the call chain size (default 16, max. 1024) for instructions | ||
247 | events can be specified. | ||
248 | |||
249 | To disable decoding entirely, use --no-itrace. | ||
250 | |||
224 | SEE ALSO | 251 | SEE ALSO |
225 | -------- | 252 | -------- |
226 | linkperf:perf-record[1], linkperf:perf-script-perl[1], | 253 | linkperf:perf-record[1], linkperf:perf-script-perl[1], |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 58f10b8e6ff2..7682665456fe 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include "util/evsel.h" | 16 | #include "util/evsel.h" |
17 | #include "util/sort.h" | 17 | #include "util/sort.h" |
18 | #include "util/data.h" | 18 | #include "util/data.h" |
19 | #include "util/auxtrace.h" | ||
19 | #include <linux/bitmap.h> | 20 | #include <linux/bitmap.h> |
20 | 21 | ||
21 | static char const *script_name; | 22 | static char const *script_name; |
@@ -1497,6 +1498,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1497 | char *rec_script_path = NULL; | 1498 | char *rec_script_path = NULL; |
1498 | char *rep_script_path = NULL; | 1499 | char *rep_script_path = NULL; |
1499 | struct perf_session *session; | 1500 | struct perf_session *session; |
1501 | struct itrace_synth_opts itrace_synth_opts = { .set = false, }; | ||
1500 | char *script_path = NULL; | 1502 | char *script_path = NULL; |
1501 | const char **__argv; | 1503 | const char **__argv; |
1502 | int i, j, err = 0; | 1504 | int i, j, err = 0; |
@@ -1511,6 +1513,10 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1511 | .attr = process_attr, | 1513 | .attr = process_attr, |
1512 | .tracing_data = perf_event__process_tracing_data, | 1514 | .tracing_data = perf_event__process_tracing_data, |
1513 | .build_id = perf_event__process_build_id, | 1515 | .build_id = perf_event__process_build_id, |
1516 | .id_index = perf_event__process_id_index, | ||
1517 | .auxtrace_info = perf_event__process_auxtrace_info, | ||
1518 | .auxtrace = perf_event__process_auxtrace, | ||
1519 | .auxtrace_error = perf_event__process_auxtrace_error, | ||
1514 | .ordered_events = true, | 1520 | .ordered_events = true, |
1515 | .ordering_requires_timestamps = true, | 1521 | .ordering_requires_timestamps = true, |
1516 | }, | 1522 | }, |
@@ -1570,6 +1576,9 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1570 | OPT_BOOLEAN('\0', "show-mmap-events", &script.show_mmap_events, | 1576 | OPT_BOOLEAN('\0', "show-mmap-events", &script.show_mmap_events, |
1571 | "Show the mmap events"), | 1577 | "Show the mmap events"), |
1572 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), | 1578 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), |
1579 | OPT_CALLBACK_OPTARG(0, "itrace", &itrace_synth_opts, NULL, "opts", | ||
1580 | "Instruction Tracing options", | ||
1581 | itrace_parse_synth_opts), | ||
1573 | OPT_END() | 1582 | OPT_END() |
1574 | }; | 1583 | }; |
1575 | const char * const script_subcommands[] = { "record", "report", NULL }; | 1584 | const char * const script_subcommands[] = { "record", "report", NULL }; |
@@ -1765,6 +1774,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1765 | 1774 | ||
1766 | script.session = session; | 1775 | script.session = session; |
1767 | 1776 | ||
1777 | session->itrace_synth_opts = &itrace_synth_opts; | ||
1778 | |||
1768 | if (cpu_list) { | 1779 | if (cpu_list) { |
1769 | err = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); | 1780 | err = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); |
1770 | if (err < 0) | 1781 | if (err < 0) |