blob: 7d12f33a3a069690c6cfa704f941060ed761e908 [file] [log] [blame]
Adrian Hunter718c6022015-04-09 18:53:42 +03001/*
2 * auxtrace.h: AUX area trace support
3 * Copyright (c) 2013-2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __PERF_AUXTRACE_H
17#define __PERF_AUXTRACE_H
18
19#include <sys/types.h>
20#include <stdbool.h>
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030021#include <stddef.h>
Adrian Huntere5027892015-04-21 12:21:51 +030022#include <linux/list.h>
Adrian Hunter718c6022015-04-09 18:53:42 +030023#include <linux/perf_event.h>
24#include <linux/types.h>
25
26#include "../perf.h"
Adrian Hunter85ed4722015-04-09 18:53:50 +030027#include "event.h"
Adrian Hunterc4468702015-04-09 18:53:48 +030028#include "session.h"
Adrian Huntere31f0d02015-04-30 17:37:27 +030029#include "debug.h"
Adrian Hunter718c6022015-04-09 18:53:42 +030030
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030031union perf_event;
32struct perf_session;
Adrian Hunter718c6022015-04-09 18:53:42 +030033struct perf_evlist;
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030034struct perf_tool;
Adrian Hunterf6986c952015-04-09 18:53:49 +030035struct option;
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030036struct record_opts;
37struct auxtrace_info_event;
Adrian Hunter85ed4722015-04-09 18:53:50 +030038struct events_stats;
Adrian Hunter718c6022015-04-09 18:53:42 +030039
Adrian Hunter73f75fb2015-04-09 18:53:53 +030040enum auxtrace_type {
41 PERF_AUXTRACE_UNKNOWN,
Adrian Hunter55ea4ab2015-07-17 19:33:36 +030042 PERF_AUXTRACE_INTEL_PT,
Adrian Hunter73f75fb2015-04-09 18:53:53 +030043};
44
Adrian Hunterf6986c952015-04-09 18:53:49 +030045enum itrace_period_type {
46 PERF_ITRACE_PERIOD_INSTRUCTIONS,
47 PERF_ITRACE_PERIOD_TICKS,
48 PERF_ITRACE_PERIOD_NANOSECS,
49};
50
51/**
52 * struct itrace_synth_opts - AUX area tracing synthesis options.
53 * @set: indicates whether or not options have been set
54 * @inject: indicates the event (not just the sample) must be fully synthesized
55 * because 'perf inject' will write it out
56 * @instructions: whether to synthesize 'instructions' events
57 * @branches: whether to synthesize 'branches' events
Adrian Hunter53c76b02015-04-30 17:37:28 +030058 * @transactions: whether to synthesize events for transactions
Adrian Hunterf6986c952015-04-09 18:53:49 +030059 * @errors: whether to synthesize decoder error events
60 * @dont_decode: whether to skip decoding entirely
61 * @log: write a decoding log
62 * @calls: limit branch samples to calls (can be combined with @returns)
63 * @returns: limit branch samples to returns (can be combined with @calls)
64 * @callchain: add callchain to 'instructions' events
65 * @callchain_sz: maximum callchain size
66 * @period: 'instructions' events period
67 * @period_type: 'instructions' events period type
68 */
69struct itrace_synth_opts {
70 bool set;
71 bool inject;
72 bool instructions;
73 bool branches;
Adrian Hunter53c76b02015-04-30 17:37:28 +030074 bool transactions;
Adrian Hunterf6986c952015-04-09 18:53:49 +030075 bool errors;
76 bool dont_decode;
77 bool log;
78 bool calls;
79 bool returns;
80 bool callchain;
81 unsigned int callchain_sz;
82 unsigned long long period;
83 enum itrace_period_type period_type;
84};
85
Adrian Hunter718c6022015-04-09 18:53:42 +030086/**
Adrian Hunter99fa2982015-04-30 17:37:25 +030087 * struct auxtrace_index_entry - indexes a AUX area tracing event within a
88 * perf.data file.
89 * @file_offset: offset within the perf.data file
90 * @sz: size of the event
91 */
92struct auxtrace_index_entry {
93 u64 file_offset;
94 u64 sz;
95};
96
97#define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
98
99/**
100 * struct auxtrace_index - index of AUX area tracing events within a perf.data
101 * file.
102 * @list: linking a number of arrays of entries
103 * @nr: number of entries
104 * @entries: array of entries
105 */
106struct auxtrace_index {
107 struct list_head list;
108 size_t nr;
109 struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
110};
111
112/**
Adrian Hunterc4468702015-04-09 18:53:48 +0300113 * struct auxtrace - session callbacks to allow AUX area data decoding.
114 * @process_event: lets the decoder see all session events
115 * @flush_events: process any remaining data
116 * @free_events: free resources associated with event processing
117 * @free: free resources associated with the session
118 */
119struct auxtrace {
120 int (*process_event)(struct perf_session *session,
121 union perf_event *event,
122 struct perf_sample *sample,
123 struct perf_tool *tool);
Adrian Hunter73f75fb2015-04-09 18:53:53 +0300124 int (*process_auxtrace_event)(struct perf_session *session,
125 union perf_event *event,
126 struct perf_tool *tool);
Adrian Hunterc4468702015-04-09 18:53:48 +0300127 int (*flush_events)(struct perf_session *session,
128 struct perf_tool *tool);
129 void (*free_events)(struct perf_session *session);
130 void (*free)(struct perf_session *session);
131};
132
133/**
Adrian Huntere5027892015-04-21 12:21:51 +0300134 * struct auxtrace_buffer - a buffer containing AUX area tracing data.
135 * @list: buffers are queued in a list held by struct auxtrace_queue
136 * @size: size of the buffer in bytes
137 * @pid: in per-thread mode, the pid this buffer is associated with
138 * @tid: in per-thread mode, the tid this buffer is associated with
139 * @cpu: in per-cpu mode, the cpu this buffer is associated with
140 * @data: actual buffer data (can be null if the data has not been loaded)
141 * @data_offset: file offset at which the buffer can be read
142 * @mmap_addr: mmap address at which the buffer can be read
143 * @mmap_size: size of the mmap at @mmap_addr
144 * @data_needs_freeing: @data was malloc'd so free it when it is no longer
145 * needed
146 * @consecutive: the original data was split up and this buffer is consecutive
147 * to the previous buffer
148 * @offset: offset as determined by aux_head / aux_tail members of struct
149 * perf_event_mmap_page
150 * @reference: an implementation-specific reference determined when the data is
151 * recorded
152 * @buffer_nr: used to number each buffer
153 * @use_size: implementation actually only uses this number of bytes
154 * @use_data: implementation actually only uses data starting at this address
155 */
156struct auxtrace_buffer {
157 struct list_head list;
158 size_t size;
159 pid_t pid;
160 pid_t tid;
161 int cpu;
162 void *data;
163 off_t data_offset;
164 void *mmap_addr;
165 size_t mmap_size;
166 bool data_needs_freeing;
167 bool consecutive;
168 u64 offset;
169 u64 reference;
170 u64 buffer_nr;
171 size_t use_size;
172 void *use_data;
173};
174
175/**
176 * struct auxtrace_queue - a queue of AUX area tracing data buffers.
177 * @head: head of buffer list
178 * @tid: in per-thread mode, the tid this queue is associated with
179 * @cpu: in per-cpu mode, the cpu this queue is associated with
180 * @set: %true once this queue has been dedicated to a specific thread or cpu
181 * @priv: implementation-specific data
182 */
183struct auxtrace_queue {
184 struct list_head head;
185 pid_t tid;
186 int cpu;
187 bool set;
188 void *priv;
189};
190
191/**
192 * struct auxtrace_queues - an array of AUX area tracing queues.
193 * @queue_array: array of queues
194 * @nr_queues: number of queues
195 * @new_data: set whenever new data is queued
196 * @populated: queues have been fully populated using the auxtrace_index
197 * @next_buffer_nr: used to number each buffer
198 */
199struct auxtrace_queues {
200 struct auxtrace_queue *queue_array;
201 unsigned int nr_queues;
202 bool new_data;
203 bool populated;
204 u64 next_buffer_nr;
205};
206
207/**
Adrian Hunterf9397152015-04-09 18:53:52 +0300208 * struct auxtrace_heap_item - element of struct auxtrace_heap.
209 * @queue_nr: queue number
210 * @ordinal: value used for sorting (lowest ordinal is top of the heap) expected
211 * to be a timestamp
212 */
213struct auxtrace_heap_item {
214 unsigned int queue_nr;
215 u64 ordinal;
216};
217
218/**
219 * struct auxtrace_heap - a heap suitable for sorting AUX area tracing queues.
220 * @heap_array: the heap
221 * @heap_cnt: the number of elements in the heap
222 * @heap_sz: maximum number of elements (grows as needed)
223 */
224struct auxtrace_heap {
225 struct auxtrace_heap_item *heap_array;
226 unsigned int heap_cnt;
227 unsigned int heap_sz;
228};
229
230/**
Adrian Hunter718c6022015-04-09 18:53:42 +0300231 * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
232 * @base: address of mapped area
233 * @userpg: pointer to buffer's perf_event_mmap_page
234 * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
235 * @len: size of mapped area
236 * @prev: previous aux_head
237 * @idx: index of this mmap
238 * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
239 * mmap) otherwise %0
240 * @cpu: cpu number for a per-cpu mmap otherwise %-1
241 */
242struct auxtrace_mmap {
243 void *base;
244 void *userpg;
245 size_t mask;
246 size_t len;
247 u64 prev;
248 int idx;
249 pid_t tid;
250 int cpu;
251};
252
253/**
254 * struct auxtrace_mmap_params - parameters to set up struct auxtrace_mmap.
255 * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
256 * @offset: file offset of mapped area
257 * @len: size of mapped area
258 * @prot: mmap memory protection
259 * @idx: index of this mmap
260 * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
261 * mmap) otherwise %0
262 * @cpu: cpu number for a per-cpu mmap otherwise %-1
263 */
264struct auxtrace_mmap_params {
265 size_t mask;
266 off_t offset;
267 size_t len;
268 int prot;
269 int idx;
270 pid_t tid;
271 int cpu;
272};
273
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300274/**
275 * struct auxtrace_record - callbacks for recording AUX area data.
276 * @recording_options: validate and process recording options
277 * @info_priv_size: return the size of the private data in auxtrace_info_event
278 * @info_fill: fill-in the private data in auxtrace_info_event
279 * @free: free this auxtrace record structure
Adrian Hunterd20031b2015-04-30 17:37:31 +0300280 * @snapshot_start: starting a snapshot
281 * @snapshot_finish: finishing a snapshot
282 * @find_snapshot: find data to snapshot within auxtrace mmap
283 * @parse_snapshot_options: parse snapshot options
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300284 * @reference: provide a 64-bit reference number for auxtrace_event
285 * @read_finish: called after reading from an auxtrace mmap
286 */
287struct auxtrace_record {
288 int (*recording_options)(struct auxtrace_record *itr,
289 struct perf_evlist *evlist,
290 struct record_opts *opts);
291 size_t (*info_priv_size)(struct auxtrace_record *itr);
292 int (*info_fill)(struct auxtrace_record *itr,
293 struct perf_session *session,
294 struct auxtrace_info_event *auxtrace_info,
295 size_t priv_size);
296 void (*free)(struct auxtrace_record *itr);
Adrian Hunterd20031b2015-04-30 17:37:31 +0300297 int (*snapshot_start)(struct auxtrace_record *itr);
298 int (*snapshot_finish)(struct auxtrace_record *itr);
299 int (*find_snapshot)(struct auxtrace_record *itr, int idx,
300 struct auxtrace_mmap *mm, unsigned char *data,
301 u64 *head, u64 *old);
302 int (*parse_snapshot_options)(struct auxtrace_record *itr,
303 struct record_opts *opts,
304 const char *str);
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300305 u64 (*reference)(struct auxtrace_record *itr);
306 int (*read_finish)(struct auxtrace_record *itr, int idx);
Adrian Hunter83b2ea22015-05-29 16:33:38 +0300307 unsigned int alignment;
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300308};
309
Adrian Huntere31f0d02015-04-30 17:37:27 +0300310#ifdef HAVE_AUXTRACE_SUPPORT
311
Adrian Hunterd20031b2015-04-30 17:37:31 +0300312/*
313 * In snapshot mode the mmapped page is read-only which makes using
314 * __sync_val_compare_and_swap() problematic. However, snapshot mode expects
315 * the buffer is not updated while the snapshot is made (e.g. Intel PT disables
316 * the event) so there is not a race anyway.
317 */
318static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
319{
320 struct perf_event_mmap_page *pc = mm->userpg;
321 u64 head = ACCESS_ONCE(pc->aux_head);
322
323 /* Ensure all reads are done after we read the head */
324 rmb();
325 return head;
326}
327
Adrian Hunter718c6022015-04-09 18:53:42 +0300328static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
329{
330 struct perf_event_mmap_page *pc = mm->userpg;
331#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
332 u64 head = ACCESS_ONCE(pc->aux_head);
333#else
334 u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
335#endif
336
337 /* Ensure all reads are done after we read the head */
338 rmb();
339 return head;
340}
341
342static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail)
343{
344 struct perf_event_mmap_page *pc = mm->userpg;
345#if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
346 u64 old_tail;
347#endif
348
349 /* Ensure all reads are done before we write the tail out */
350 mb();
351#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
352 pc->aux_tail = tail;
353#else
354 do {
355 old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
356 } while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
357#endif
358}
359
360int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
361 struct auxtrace_mmap_params *mp,
362 void *userpg, int fd);
363void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
364void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
365 off_t auxtrace_offset,
366 unsigned int auxtrace_pages,
367 bool auxtrace_overwrite);
368void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
369 struct perf_evlist *evlist, int idx,
370 bool per_cpu);
371
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300372typedef int (*process_auxtrace_t)(struct perf_tool *tool,
373 union perf_event *event, void *data1,
374 size_t len1, void *data2, size_t len2);
375
376int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr,
377 struct perf_tool *tool, process_auxtrace_t fn);
378
Adrian Hunterd20031b2015-04-30 17:37:31 +0300379int auxtrace_mmap__read_snapshot(struct auxtrace_mmap *mm,
380 struct auxtrace_record *itr,
381 struct perf_tool *tool, process_auxtrace_t fn,
382 size_t snapshot_size);
383
Adrian Huntere5027892015-04-21 12:21:51 +0300384int auxtrace_queues__init(struct auxtrace_queues *queues);
385int auxtrace_queues__add_event(struct auxtrace_queues *queues,
386 struct perf_session *session,
387 union perf_event *event, off_t data_offset,
388 struct auxtrace_buffer **buffer_ptr);
389void auxtrace_queues__free(struct auxtrace_queues *queues);
Adrian Hunter99fa2982015-04-30 17:37:25 +0300390int auxtrace_queues__process_index(struct auxtrace_queues *queues,
391 struct perf_session *session);
Adrian Huntere5027892015-04-21 12:21:51 +0300392struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
393 struct auxtrace_buffer *buffer);
394void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
395void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
396void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
397void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
Adrian Hunterf9397152015-04-09 18:53:52 +0300398
399int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
400 u64 ordinal);
401void auxtrace_heap__pop(struct auxtrace_heap *heap);
402void auxtrace_heap__free(struct auxtrace_heap *heap);
403
Adrian Hunterc3278f02015-04-09 18:53:54 +0300404struct auxtrace_cache_entry {
405 struct hlist_node hash;
406 u32 key;
407};
408
409struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
410 unsigned int limit_percent);
411void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
412void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
413void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
414int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
415 struct auxtrace_cache_entry *entry);
416void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
417
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300418struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
419 int *err);
420
Adrian Hunterd20031b2015-04-30 17:37:31 +0300421int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
422 struct record_opts *opts,
423 const char *str);
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300424int auxtrace_record__options(struct auxtrace_record *itr,
425 struct perf_evlist *evlist,
426 struct record_opts *opts);
427size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr);
428int auxtrace_record__info_fill(struct auxtrace_record *itr,
429 struct perf_session *session,
430 struct auxtrace_info_event *auxtrace_info,
431 size_t priv_size);
432void auxtrace_record__free(struct auxtrace_record *itr);
Adrian Hunterd20031b2015-04-30 17:37:31 +0300433int auxtrace_record__snapshot_start(struct auxtrace_record *itr);
434int auxtrace_record__snapshot_finish(struct auxtrace_record *itr);
435int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
436 struct auxtrace_mmap *mm,
437 unsigned char *data, u64 *head, u64 *old);
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300438u64 auxtrace_record__reference(struct auxtrace_record *itr);
439
Adrian Hunter99fa2982015-04-30 17:37:25 +0300440int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
441 off_t file_offset);
442int auxtrace_index__write(int fd, struct list_head *head);
443int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
444 bool needs_swap);
445void auxtrace_index__free(struct list_head *head);
446
Adrian Hunter85ed4722015-04-09 18:53:50 +0300447void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type,
448 int code, int cpu, pid_t pid, pid_t tid, u64 ip,
449 const char *msg);
450
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300451int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
452 struct perf_tool *tool,
453 struct perf_session *session,
454 perf_event__handler_t process);
Adrian Hunter73f75fb2015-04-09 18:53:53 +0300455int perf_event__process_auxtrace_info(struct perf_tool *tool,
456 union perf_event *event,
457 struct perf_session *session);
458s64 perf_event__process_auxtrace(struct perf_tool *tool,
459 union perf_event *event,
460 struct perf_session *session);
Adrian Hunter85ed4722015-04-09 18:53:50 +0300461int perf_event__process_auxtrace_error(struct perf_tool *tool,
462 union perf_event *event,
463 struct perf_session *session);
Adrian Hunterf6986c952015-04-09 18:53:49 +0300464int itrace_parse_synth_opts(const struct option *opt, const char *str,
465 int unset);
466void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts);
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +0300467
Adrian Hunter85ed4722015-04-09 18:53:50 +0300468size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
469void perf_session__auxtrace_error_inc(struct perf_session *session,
470 union perf_event *event);
471void events_stats__auxtrace_error_warn(const struct events_stats *stats);
472
Adrian Hunterc4468702015-04-09 18:53:48 +0300473static inline int auxtrace__process_event(struct perf_session *session,
474 union perf_event *event,
475 struct perf_sample *sample,
476 struct perf_tool *tool)
477{
478 if (!session->auxtrace)
479 return 0;
480
481 return session->auxtrace->process_event(session, event, sample, tool);
482}
483
484static inline int auxtrace__flush_events(struct perf_session *session,
485 struct perf_tool *tool)
486{
487 if (!session->auxtrace)
488 return 0;
489
490 return session->auxtrace->flush_events(session, tool);
491}
492
493static inline void auxtrace__free_events(struct perf_session *session)
494{
495 if (!session->auxtrace)
496 return;
497
498 return session->auxtrace->free_events(session);
499}
500
501static inline void auxtrace__free(struct perf_session *session)
502{
503 if (!session->auxtrace)
504 return;
505
506 return session->auxtrace->free(session);
507}
508
Adrian Huntere31f0d02015-04-30 17:37:27 +0300509#else
510
511static inline struct auxtrace_record *
512auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
513 int *err __maybe_unused)
514{
515 *err = 0;
516 return NULL;
517}
518
519static inline
520void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
521{
522}
523
524static inline int
525perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
526 struct perf_tool *tool __maybe_unused,
527 struct perf_session *session __maybe_unused,
528 perf_event__handler_t process __maybe_unused)
529{
530 return -EINVAL;
531}
532
533static inline
534int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
535 struct perf_evlist *evlist __maybe_unused,
536 struct record_opts *opts __maybe_unused)
537{
538 return 0;
539}
540
541#define perf_event__process_auxtrace_info 0
542#define perf_event__process_auxtrace 0
543#define perf_event__process_auxtrace_error 0
544
545static inline
546void perf_session__auxtrace_error_inc(struct perf_session *session
547 __maybe_unused,
548 union perf_event *event
549 __maybe_unused)
550{
551}
552
553static inline
554void events_stats__auxtrace_error_warn(const struct events_stats *stats
555 __maybe_unused)
556{
557}
558
559static inline
560int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
561 const char *str __maybe_unused,
562 int unset __maybe_unused)
563{
564 pr_err("AUX area tracing not supported\n");
565 return -EINVAL;
566}
567
568static inline
Adrian Hunter2dd6d8a2015-04-30 17:37:32 +0300569int auxtrace_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
570 struct record_opts *opts __maybe_unused,
571 const char *str)
572{
573 if (!str)
574 return 0;
575 pr_err("AUX area tracing not supported\n");
576 return -EINVAL;
577}
578
579static inline
Adrian Huntere31f0d02015-04-30 17:37:27 +0300580int auxtrace__process_event(struct perf_session *session __maybe_unused,
581 union perf_event *event __maybe_unused,
582 struct perf_sample *sample __maybe_unused,
583 struct perf_tool *tool __maybe_unused)
584{
585 return 0;
586}
587
588static inline
589int auxtrace__flush_events(struct perf_session *session __maybe_unused,
590 struct perf_tool *tool __maybe_unused)
591{
592 return 0;
593}
594
595static inline
596void auxtrace__free_events(struct perf_session *session __maybe_unused)
597{
598}
599
600static inline
601void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
602{
603}
604
605static inline
606void auxtrace__free(struct perf_session *session __maybe_unused)
607{
608}
609
610static inline
611int auxtrace_index__write(int fd __maybe_unused,
612 struct list_head *head __maybe_unused)
613{
614 return -EINVAL;
615}
616
617static inline
618int auxtrace_index__process(int fd __maybe_unused,
619 u64 size __maybe_unused,
620 struct perf_session *session __maybe_unused,
621 bool needs_swap __maybe_unused)
622{
623 return -EINVAL;
624}
625
626static inline
627void auxtrace_index__free(struct list_head *head __maybe_unused)
628{
629}
630
631int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
632 struct auxtrace_mmap_params *mp,
633 void *userpg, int fd);
634void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
635void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
636 off_t auxtrace_offset,
637 unsigned int auxtrace_pages,
638 bool auxtrace_overwrite);
639void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
640 struct perf_evlist *evlist, int idx,
641 bool per_cpu);
642
643#endif
644
Adrian Hunter718c6022015-04-09 18:53:42 +0300645#endif