aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/auxtrace.h
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-04-09 11:53:48 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-29 09:37:53 -0400
commitc446870d80f37281a927b5f6984bd47397a7cb03 (patch)
tree8f6fd133fb0f790176b6776eb41a902a8741f548 /tools/perf/util/auxtrace.h
parente9bf54d25f4f64c410c2aca644749a3325b96f5a (diff)
perf session: Add hooks to allow transparent decoding of AUX area tracing data
Hook into session processing so that AUX area decoding can synthesize events transparently to the tools. The advantages of transparent decoding are that tools can be used directly with perf.data files containing AUX area tracing data, which is easier for the user and more efficient than having a separate decoding tool. This will work as follows: 1. Tools will feed auxtrace events to the decoder using perf_tool->auxtrace() (support for that still to come). 2. The decoder can process side-band events as needed due to the auxtrace->process_event() hook. 3. The decoder can deliver synthesized events into the event stream using perf_session__deliver_synth_event(). Note the expectation is that decoding will work on data that is time-ordered with respect to the per-cpu or per-thread contexts that were recorded. 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-9-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.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 7ab4850703f0..199fc27b3954 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -23,6 +23,7 @@
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#include "../perf.h" 25#include "../perf.h"
26#include "session.h"
26 27
27union perf_event; 28union perf_event;
28struct perf_session; 29struct perf_session;
@@ -32,6 +33,24 @@ struct record_opts;
32struct auxtrace_info_event; 33struct auxtrace_info_event;
33 34
34/** 35/**
36 * struct auxtrace - session callbacks to allow AUX area data decoding.
37 * @process_event: lets the decoder see all session events
38 * @flush_events: process any remaining data
39 * @free_events: free resources associated with event processing
40 * @free: free resources associated with the session
41 */
42struct auxtrace {
43 int (*process_event)(struct perf_session *session,
44 union perf_event *event,
45 struct perf_sample *sample,
46 struct perf_tool *tool);
47 int (*flush_events)(struct perf_session *session,
48 struct perf_tool *tool);
49 void (*free_events)(struct perf_session *session);
50 void (*free)(struct perf_session *session);
51};
52
53/**
35 * struct auxtrace_mmap - records an mmap of the auxtrace buffer. 54 * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
36 * @base: address of mapped area 55 * @base: address of mapped area
37 * @userpg: pointer to buffer's perf_event_mmap_page 56 * @userpg: pointer to buffer's perf_event_mmap_page
@@ -168,4 +187,40 @@ int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
168 struct perf_session *session, 187 struct perf_session *session,
169 perf_event__handler_t process); 188 perf_event__handler_t process);
170 189
190static inline int auxtrace__process_event(struct perf_session *session,
191 union perf_event *event,
192 struct perf_sample *sample,
193 struct perf_tool *tool)
194{
195 if (!session->auxtrace)
196 return 0;
197
198 return session->auxtrace->process_event(session, event, sample, tool);
199}
200
201static inline int auxtrace__flush_events(struct perf_session *session,
202 struct perf_tool *tool)
203{
204 if (!session->auxtrace)
205 return 0;
206
207 return session->auxtrace->flush_events(session, tool);
208}
209
210static inline void auxtrace__free_events(struct perf_session *session)
211{
212 if (!session->auxtrace)
213 return;
214
215 return session->auxtrace->free_events(session);
216}
217
218static inline void auxtrace__free(struct perf_session *session)
219{
220 if (!session->auxtrace)
221 return;
222
223 return session->auxtrace->free(session);
224}
225
171#endif 226#endif