aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/auxtrace.h
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-04-09 11:53:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-29 09:37:51 -0400
commit9e0cc4fe3752661220ee2cf7fcd335e233eea470 (patch)
tree50df3f0d05e25ed0a196f6b892679a352787b166 /tools/perf/util/auxtrace.h
parenta16ac0233ea1da8af3c2046a67c2527b4a452166 (diff)
perf auxtrace: Add support for AUX area recording
Add support for reading from the AUX area tracing mmap and synthesizing AUX area tracing events. This patch introduces an abstraction for recording AUX area data. Recording is initialized by auxtrace_record__init() which is a weak function to be implemented by the architecture to provide recording callbacks. Recording is mainly handled by auxtrace_mmap__read() and perf_event__synthesize_auxtrace() but there are callbacks for miscellaneous needs including validating and processing user options, populating private data in auxtrace_info_event, and freeing the structure when finished. 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/1428594864-29309-5-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.h56
1 files changed, 55 insertions, 1 deletions
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 2071b36560a0..7ab4850703f0 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -18,13 +18,18 @@
18 18
19#include <sys/types.h> 19#include <sys/types.h>
20#include <stdbool.h> 20#include <stdbool.h>
21 21#include <stddef.h>
22#include <linux/perf_event.h> 22#include <linux/perf_event.h>
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#include "../perf.h" 25#include "../perf.h"
26 26
27union perf_event;
28struct perf_session;
27struct perf_evlist; 29struct perf_evlist;
30struct perf_tool;
31struct record_opts;
32struct auxtrace_info_event;
28 33
29/** 34/**
30 * struct auxtrace_mmap - records an mmap of the auxtrace buffer. 35 * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
@@ -70,6 +75,29 @@ struct auxtrace_mmap_params {
70 int cpu; 75 int cpu;
71}; 76};
72 77
78/**
79 * struct auxtrace_record - callbacks for recording AUX area data.
80 * @recording_options: validate and process recording options
81 * @info_priv_size: return the size of the private data in auxtrace_info_event
82 * @info_fill: fill-in the private data in auxtrace_info_event
83 * @free: free this auxtrace record structure
84 * @reference: provide a 64-bit reference number for auxtrace_event
85 * @read_finish: called after reading from an auxtrace mmap
86 */
87struct auxtrace_record {
88 int (*recording_options)(struct auxtrace_record *itr,
89 struct perf_evlist *evlist,
90 struct record_opts *opts);
91 size_t (*info_priv_size)(struct auxtrace_record *itr);
92 int (*info_fill)(struct auxtrace_record *itr,
93 struct perf_session *session,
94 struct auxtrace_info_event *auxtrace_info,
95 size_t priv_size);
96 void (*free)(struct auxtrace_record *itr);
97 u64 (*reference)(struct auxtrace_record *itr);
98 int (*read_finish)(struct auxtrace_record *itr, int idx);
99};
100
73static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm) 101static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
74{ 102{
75 struct perf_event_mmap_page *pc = mm->userpg; 103 struct perf_event_mmap_page *pc = mm->userpg;
@@ -114,4 +142,30 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
114 struct perf_evlist *evlist, int idx, 142 struct perf_evlist *evlist, int idx,
115 bool per_cpu); 143 bool per_cpu);
116 144
145typedef int (*process_auxtrace_t)(struct perf_tool *tool,
146 union perf_event *event, void *data1,
147 size_t len1, void *data2, size_t len2);
148
149int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr,
150 struct perf_tool *tool, process_auxtrace_t fn);
151
152struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
153 int *err);
154
155int auxtrace_record__options(struct auxtrace_record *itr,
156 struct perf_evlist *evlist,
157 struct record_opts *opts);
158size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr);
159int auxtrace_record__info_fill(struct auxtrace_record *itr,
160 struct perf_session *session,
161 struct auxtrace_info_event *auxtrace_info,
162 size_t priv_size);
163void auxtrace_record__free(struct auxtrace_record *itr);
164u64 auxtrace_record__reference(struct auxtrace_record *itr);
165
166int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
167 struct perf_tool *tool,
168 struct perf_session *session,
169 perf_event__handler_t process);
170
117#endif 171#endif