aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-inject.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-04-30 10:37:25 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-04 18:48:47 -0400
commit99fa298453495ee23801ab500a5fe0138c260edb (patch)
tree1bd00c1305dce664eef07a6557d83d98d4a98643 /tools/perf/builtin-inject.c
parent64a7e61f11a22de3571b7f43f231e9b3aab00f1e (diff)
perf tools: Add AUX area tracing index
Add an index of AUX area tracing events within a perf.data file. perf record uses a special user event PERF_RECORD_FINISHED_ROUND to enable sorting of events in chunks instead of having to sort all events altogether. AUX area tracing events contain data that can span back to the very beginning of the recording period. i.e. they do not obey the rules of PERF_RECORD_FINISHED_ROUND. By adding an index, AUX area tracing events can be found in advance and the PERF_RECORD_FINISHED_ROUND approach works as usual. The index is recorded with the auxtrace feature in the perf.data file. A session reads the index but does not process it. An AUX area decoder can queue all the AUX area data in advance using auxtrace_queues__process_index() or otherwise process the index in some custom manner. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.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/1430404667-10593-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r--tools/perf/builtin-inject.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index c5f6515f0723..6d4bbde066fd 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -122,6 +122,18 @@ static s64 perf_event__repipe_auxtrace(struct perf_tool *tool,
122 tool); 122 tool);
123 int ret; 123 int ret;
124 124
125 if (!inject->output.is_pipe) {
126 off_t offset;
127
128 offset = lseek(inject->output.fd, 0, SEEK_CUR);
129 if (offset == -1)
130 return -errno;
131 ret = auxtrace_index__auxtrace_event(&session->auxtrace_index,
132 event, offset);
133 if (ret < 0)
134 return ret;
135 }
136
125 if (perf_data_file__is_pipe(session->file) || !session->one_mmap) { 137 if (perf_data_file__is_pipe(session->file) || !session->one_mmap) {
126 ret = output_bytes(inject, event, event->header.size); 138 ret = output_bytes(inject, event, event->header.size);
127 if (ret < 0) 139 if (ret < 0)
@@ -487,6 +499,9 @@ static int __cmd_inject(struct perf_inject *inject)
487 output_data_offset = 4096; 499 output_data_offset = 4096;
488 } 500 }
489 501
502 if (!inject->itrace_synth_opts.set)
503 auxtrace_index__free(&session->auxtrace_index);
504
490 if (!file_out->is_pipe) 505 if (!file_out->is_pipe)
491 lseek(fd, output_data_offset, SEEK_SET); 506 lseek(fd, output_data_offset, SEEK_SET);
492 507