aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.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-record.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-record.c')
-rw-r--r--tools/perf/builtin-record.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 4c9aaa1f688a..c8c784c430b6 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -117,9 +117,24 @@ static int record__process_auxtrace(struct perf_tool *tool,
117 size_t len1, void *data2, size_t len2) 117 size_t len1, void *data2, size_t len2)
118{ 118{
119 struct record *rec = container_of(tool, struct record, tool); 119 struct record *rec = container_of(tool, struct record, tool);
120 struct perf_data_file *file = &rec->file;
120 size_t padding; 121 size_t padding;
121 u8 pad[8] = {0}; 122 u8 pad[8] = {0};
122 123
124 if (!perf_data_file__is_pipe(file)) {
125 off_t file_offset;
126 int fd = perf_data_file__fd(file);
127 int err;
128
129 file_offset = lseek(fd, 0, SEEK_CUR);
130 if (file_offset == -1)
131 return -1;
132 err = auxtrace_index__auxtrace_event(&rec->session->auxtrace_index,
133 event, file_offset);
134 if (err)
135 return err;
136 }
137
123 /* event.auxtrace.size includes padding, see __auxtrace_mmap__read() */ 138 /* event.auxtrace.size includes padding, see __auxtrace_mmap__read() */
124 padding = (len1 + len2) & 7; 139 padding = (len1 + len2) & 7;
125 if (padding) 140 if (padding)