[PATCH v0 57/71] perf record: Add Instruction Trace sampling support
From: Alexander Shishkin
Date: Wed Dec 11 2013 - 07:47:28 EST
From: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Add support for Instruction Trace sampling.
Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/Documentation/perf-record.txt | 5 +++++
tools/perf/builtin-record.c | 15 +++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index bb01df7..58bd3c1 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -211,6 +211,11 @@ overrides that and uses per-thread mmaps. A side-effect of that is that
inheritance is automatically disabled. --per-thread is ignored with a warning
if combined with -a or -C options.
+-I::
+--itrace::
+Enable Instruction Trace sampling. Each sample captures the specified number of
+bytes (default 4096) of trace. Instruction Tracing config can also be specified.
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 344603f..e75a15e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -401,7 +401,7 @@ static void perf_record__init_features(struct perf_record *rec)
if (!rec->opts.branch_stack)
perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK);
- if (!rec->opts.full_itrace)
+ if (!perf_record_opts_itracing(&rec->opts))
perf_header__clear_feat(&session->header, HEADER_ITRACE);
}
@@ -507,13 +507,21 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
}
}
- if (rec->opts.full_itrace) {
+ if (perf_record_opts_itracing(&rec->opts)) {
err = perf_event__synthesize_itrace_info(rec->itr, tool,
session, process_synthesized_event);
if (err)
goto out_delete_session;
}
+ if (rec->opts.sample_itrace) {
+ err = perf_event__synthesize_id_index(tool,
+ process_synthesized_event,
+ session->evlist, machine);
+ if (err)
+ goto out_delete_session;
+ }
+
err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
machine, "_text");
if (err < 0)
@@ -987,6 +995,9 @@ const struct option record_options[] = {
"sample transaction flags (special events only)"),
OPT_BOOLEAN(0, "per-thread", &record.opts.target.per_thread,
"use per-thread mmaps"),
+ OPT_CALLBACK_OPTARG('I', "itrace", &record.opts, &record.itr, "opts",
+ "sample Instruction Trace",
+ itrace_parse_sample_options),
OPT_END()
};
--
1.8.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/