aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/auxtrace.h
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/util/auxtrace.h
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/util/auxtrace.h')
-rw-r--r--tools/perf/util/auxtrace.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 53b60a64a693..b9e4b9d66f5e 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -80,6 +80,32 @@ struct itrace_synth_opts {
80}; 80};
81 81
82/** 82/**
83 * struct auxtrace_index_entry - indexes a AUX area tracing event within a
84 * perf.data file.
85 * @file_offset: offset within the perf.data file
86 * @sz: size of the event
87 */
88struct auxtrace_index_entry {
89 u64 file_offset;
90 u64 sz;
91};
92
93#define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
94
95/**
96 * struct auxtrace_index - index of AUX area tracing events within a perf.data
97 * file.
98 * @list: linking a number of arrays of entries
99 * @nr: number of entries
100 * @entries: array of entries
101 */
102struct auxtrace_index {
103 struct list_head list;
104 size_t nr;
105 struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
106};
107
108/**
83 * struct auxtrace - session callbacks to allow AUX area data decoding. 109 * struct auxtrace - session callbacks to allow AUX area data decoding.
84 * @process_event: lets the decoder see all session events 110 * @process_event: lets the decoder see all session events
85 * @flush_events: process any remaining data 111 * @flush_events: process any remaining data
@@ -321,6 +347,8 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
321 union perf_event *event, off_t data_offset, 347 union perf_event *event, off_t data_offset,
322 struct auxtrace_buffer **buffer_ptr); 348 struct auxtrace_buffer **buffer_ptr);
323void auxtrace_queues__free(struct auxtrace_queues *queues); 349void auxtrace_queues__free(struct auxtrace_queues *queues);
350int auxtrace_queues__process_index(struct auxtrace_queues *queues,
351 struct perf_session *session);
324struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue, 352struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
325 struct auxtrace_buffer *buffer); 353 struct auxtrace_buffer *buffer);
326void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd); 354void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
@@ -361,6 +389,13 @@ int auxtrace_record__info_fill(struct auxtrace_record *itr,
361void auxtrace_record__free(struct auxtrace_record *itr); 389void auxtrace_record__free(struct auxtrace_record *itr);
362u64 auxtrace_record__reference(struct auxtrace_record *itr); 390u64 auxtrace_record__reference(struct auxtrace_record *itr);
363 391
392int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
393 off_t file_offset);
394int auxtrace_index__write(int fd, struct list_head *head);
395int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
396 bool needs_swap);
397void auxtrace_index__free(struct list_head *head);
398
364void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type, 399void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type,
365 int code, int cpu, pid_t pid, pid_t tid, u64 ip, 400 int code, int cpu, pid_t pid, pid_t tid, u64 ip,
366 const char *msg); 401 const char *msg);