GNU Linux-libre 4.9.309-gnu1
[releases.git] / tools / perf / util / auxtrace.h
1 /*
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>
21 #include <stddef.h>
22 #include <linux/list.h>
23 #include <linux/perf_event.h>
24 #include <linux/types.h>
25
26 #include "../perf.h"
27 #include "event.h"
28 #include "session.h"
29 #include "debug.h"
30
31 union perf_event;
32 struct perf_session;
33 struct perf_evlist;
34 struct perf_tool;
35 struct option;
36 struct record_opts;
37 struct auxtrace_info_event;
38 struct events_stats;
39
40 /* Auxtrace records must have the same alignment as perf event records */
41 #define PERF_AUXTRACE_RECORD_ALIGNMENT 8
42
43 enum auxtrace_type {
44         PERF_AUXTRACE_UNKNOWN,
45         PERF_AUXTRACE_INTEL_PT,
46         PERF_AUXTRACE_INTEL_BTS,
47         PERF_AUXTRACE_CS_ETM,
48 };
49
50 enum itrace_period_type {
51         PERF_ITRACE_PERIOD_INSTRUCTIONS,
52         PERF_ITRACE_PERIOD_TICKS,
53         PERF_ITRACE_PERIOD_NANOSECS,
54 };
55
56 /**
57  * struct itrace_synth_opts - AUX area tracing synthesis options.
58  * @set: indicates whether or not options have been set
59  * @inject: indicates the event (not just the sample) must be fully synthesized
60  *          because 'perf inject' will write it out
61  * @instructions: whether to synthesize 'instructions' events
62  * @branches: whether to synthesize 'branches' events
63  * @transactions: whether to synthesize events for transactions
64  * @errors: whether to synthesize decoder error events
65  * @dont_decode: whether to skip decoding entirely
66  * @log: write a decoding log
67  * @calls: limit branch samples to calls (can be combined with @returns)
68  * @returns: limit branch samples to returns (can be combined with @calls)
69  * @callchain: add callchain to 'instructions' events
70  * @thread_stack: feed branches to the thread_stack
71  * @last_branch: add branch context to 'instruction' events
72  * @callchain_sz: maximum callchain size
73  * @last_branch_sz: branch context size
74  * @period: 'instructions' events period
75  * @period_type: 'instructions' events period type
76  * @initial_skip: skip N events at the beginning.
77  */
78 struct itrace_synth_opts {
79         bool                    set;
80         bool                    inject;
81         bool                    instructions;
82         bool                    branches;
83         bool                    transactions;
84         bool                    errors;
85         bool                    dont_decode;
86         bool                    log;
87         bool                    calls;
88         bool                    returns;
89         bool                    callchain;
90         bool                    thread_stack;
91         bool                    last_branch;
92         unsigned int            callchain_sz;
93         unsigned int            last_branch_sz;
94         unsigned long long      period;
95         enum itrace_period_type period_type;
96         unsigned long           initial_skip;
97 };
98
99 /**
100  * struct auxtrace_index_entry - indexes a AUX area tracing event within a
101  *                               perf.data file.
102  * @file_offset: offset within the perf.data file
103  * @sz: size of the event
104  */
105 struct auxtrace_index_entry {
106         u64                     file_offset;
107         u64                     sz;
108 };
109
110 #define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
111
112 /**
113  * struct auxtrace_index - index of AUX area tracing events within a perf.data
114  *                         file.
115  * @list: linking a number of arrays of entries
116  * @nr: number of entries
117  * @entries: array of entries
118  */
119 struct auxtrace_index {
120         struct list_head        list;
121         size_t                  nr;
122         struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
123 };
124
125 /**
126  * struct auxtrace - session callbacks to allow AUX area data decoding.
127  * @process_event: lets the decoder see all session events
128  * @flush_events: process any remaining data
129  * @free_events: free resources associated with event processing
130  * @free: free resources associated with the session
131  */
132 struct auxtrace {
133         int (*process_event)(struct perf_session *session,
134                              union perf_event *event,
135                              struct perf_sample *sample,
136                              struct perf_tool *tool);
137         int (*process_auxtrace_event)(struct perf_session *session,
138                                       union perf_event *event,
139                                       struct perf_tool *tool);
140         int (*flush_events)(struct perf_session *session,
141                             struct perf_tool *tool);
142         void (*free_events)(struct perf_session *session);
143         void (*free)(struct perf_session *session);
144 };
145
146 /**
147  * struct auxtrace_buffer - a buffer containing AUX area tracing data.
148  * @list: buffers are queued in a list held by struct auxtrace_queue
149  * @size: size of the buffer in bytes
150  * @pid: in per-thread mode, the pid this buffer is associated with
151  * @tid: in per-thread mode, the tid this buffer is associated with
152  * @cpu: in per-cpu mode, the cpu this buffer is associated with
153  * @data: actual buffer data (can be null if the data has not been loaded)
154  * @data_offset: file offset at which the buffer can be read
155  * @mmap_addr: mmap address at which the buffer can be read
156  * @mmap_size: size of the mmap at @mmap_addr
157  * @data_needs_freeing: @data was malloc'd so free it when it is no longer
158  *                      needed
159  * @consecutive: the original data was split up and this buffer is consecutive
160  *               to the previous buffer
161  * @offset: offset as determined by aux_head / aux_tail members of struct
162  *          perf_event_mmap_page
163  * @reference: an implementation-specific reference determined when the data is
164  *             recorded
165  * @buffer_nr: used to number each buffer
166  * @use_size: implementation actually only uses this number of bytes
167  * @use_data: implementation actually only uses data starting at this address
168  */
169 struct auxtrace_buffer {
170         struct list_head        list;
171         size_t                  size;
172         pid_t                   pid;
173         pid_t                   tid;
174         int                     cpu;
175         void                    *data;
176         off_t                   data_offset;
177         void                    *mmap_addr;
178         size_t                  mmap_size;
179         bool                    data_needs_freeing;
180         bool                    consecutive;
181         u64                     offset;
182         u64                     reference;
183         u64                     buffer_nr;
184         size_t                  use_size;
185         void                    *use_data;
186 };
187
188 /**
189  * struct auxtrace_queue - a queue of AUX area tracing data buffers.
190  * @head: head of buffer list
191  * @tid: in per-thread mode, the tid this queue is associated with
192  * @cpu: in per-cpu mode, the cpu this queue is associated with
193  * @set: %true once this queue has been dedicated to a specific thread or cpu
194  * @priv: implementation-specific data
195  */
196 struct auxtrace_queue {
197         struct list_head        head;
198         pid_t                   tid;
199         int                     cpu;
200         bool                    set;
201         void                    *priv;
202 };
203
204 /**
205  * struct auxtrace_queues - an array of AUX area tracing queues.
206  * @queue_array: array of queues
207  * @nr_queues: number of queues
208  * @new_data: set whenever new data is queued
209  * @populated: queues have been fully populated using the auxtrace_index
210  * @next_buffer_nr: used to number each buffer
211  */
212 struct auxtrace_queues {
213         struct auxtrace_queue   *queue_array;
214         unsigned int            nr_queues;
215         bool                    new_data;
216         bool                    populated;
217         u64                     next_buffer_nr;
218 };
219
220 /**
221  * struct auxtrace_heap_item - element of struct auxtrace_heap.
222  * @queue_nr: queue number
223  * @ordinal: value used for sorting (lowest ordinal is top of the heap) expected
224  *           to be a timestamp
225  */
226 struct auxtrace_heap_item {
227         unsigned int            queue_nr;
228         u64                     ordinal;
229 };
230
231 /**
232  * struct auxtrace_heap - a heap suitable for sorting AUX area tracing queues.
233  * @heap_array: the heap
234  * @heap_cnt: the number of elements in the heap
235  * @heap_sz: maximum number of elements (grows as needed)
236  */
237 struct auxtrace_heap {
238         struct auxtrace_heap_item       *heap_array;
239         unsigned int            heap_cnt;
240         unsigned int            heap_sz;
241 };
242
243 /**
244  * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
245  * @base: address of mapped area
246  * @userpg: pointer to buffer's perf_event_mmap_page
247  * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
248  * @len: size of mapped area
249  * @prev: previous aux_head
250  * @idx: index of this mmap
251  * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
252  *       mmap) otherwise %0
253  * @cpu: cpu number for a per-cpu mmap otherwise %-1
254  */
255 struct auxtrace_mmap {
256         void            *base;
257         void            *userpg;
258         size_t          mask;
259         size_t          len;
260         u64             prev;
261         int             idx;
262         pid_t           tid;
263         int             cpu;
264 };
265
266 /**
267  * struct auxtrace_mmap_params - parameters to set up struct auxtrace_mmap.
268  * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
269  * @offset: file offset of mapped area
270  * @len: size of mapped area
271  * @prot: mmap memory protection
272  * @idx: index of this mmap
273  * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
274  *       mmap) otherwise %0
275  * @cpu: cpu number for a per-cpu mmap otherwise %-1
276  */
277 struct auxtrace_mmap_params {
278         size_t          mask;
279         off_t           offset;
280         size_t          len;
281         int             prot;
282         int             idx;
283         pid_t           tid;
284         int             cpu;
285 };
286
287 /**
288  * struct auxtrace_record - callbacks for recording AUX area data.
289  * @recording_options: validate and process recording options
290  * @info_priv_size: return the size of the private data in auxtrace_info_event
291  * @info_fill: fill-in the private data in auxtrace_info_event
292  * @free: free this auxtrace record structure
293  * @snapshot_start: starting a snapshot
294  * @snapshot_finish: finishing a snapshot
295  * @find_snapshot: find data to snapshot within auxtrace mmap
296  * @parse_snapshot_options: parse snapshot options
297  * @reference: provide a 64-bit reference number for auxtrace_event
298  * @read_finish: called after reading from an auxtrace mmap
299  */
300 struct auxtrace_record {
301         int (*recording_options)(struct auxtrace_record *itr,
302                                  struct perf_evlist *evlist,
303                                  struct record_opts *opts);
304         size_t (*info_priv_size)(struct auxtrace_record *itr,
305                                  struct perf_evlist *evlist);
306         int (*info_fill)(struct auxtrace_record *itr,
307                          struct perf_session *session,
308                          struct auxtrace_info_event *auxtrace_info,
309                          size_t priv_size);
310         void (*free)(struct auxtrace_record *itr);
311         int (*snapshot_start)(struct auxtrace_record *itr);
312         int (*snapshot_finish)(struct auxtrace_record *itr);
313         int (*find_snapshot)(struct auxtrace_record *itr, int idx,
314                              struct auxtrace_mmap *mm, unsigned char *data,
315                              u64 *head, u64 *old);
316         int (*parse_snapshot_options)(struct auxtrace_record *itr,
317                                       struct record_opts *opts,
318                                       const char *str);
319         u64 (*reference)(struct auxtrace_record *itr);
320         int (*read_finish)(struct auxtrace_record *itr, int idx);
321         unsigned int alignment;
322 };
323
324 /**
325  * struct addr_filter - address filter.
326  * @list: list node
327  * @range: true if it is a range filter
328  * @start: true if action is 'filter' or 'start'
329  * @action: 'filter', 'start' or 'stop' ('tracestop' is accepted but converted
330  *          to 'stop')
331  * @sym_from: symbol name for the filter address
332  * @sym_to: symbol name that determines the filter size
333  * @sym_from_idx: selects n'th from symbols with the same name (0 means global
334  *                and less than 0 means symbol must be unique)
335  * @sym_to_idx: same as @sym_from_idx but for @sym_to
336  * @addr: filter address
337  * @size: filter region size (for range filters)
338  * @filename: DSO file name or NULL for the kernel
339  * @str: allocated string that contains the other string members
340  */
341 struct addr_filter {
342         struct list_head        list;
343         bool                    range;
344         bool                    start;
345         const char              *action;
346         const char              *sym_from;
347         const char              *sym_to;
348         int                     sym_from_idx;
349         int                     sym_to_idx;
350         u64                     addr;
351         u64                     size;
352         const char              *filename;
353         char                    *str;
354 };
355
356 /**
357  * struct addr_filters - list of address filters.
358  * @head: list of address filters
359  * @cnt: number of address filters
360  */
361 struct addr_filters {
362         struct list_head        head;
363         int                     cnt;
364 };
365
366 #ifdef HAVE_AUXTRACE_SUPPORT
367
368 /*
369  * In snapshot mode the mmapped page is read-only which makes using
370  * __sync_val_compare_and_swap() problematic.  However, snapshot mode expects
371  * the buffer is not updated while the snapshot is made (e.g. Intel PT disables
372  * the event) so there is not a race anyway.
373  */
374 static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
375 {
376         struct perf_event_mmap_page *pc = mm->userpg;
377         u64 head = ACCESS_ONCE(pc->aux_head);
378
379         /* Ensure all reads are done after we read the head */
380         rmb();
381         return head;
382 }
383
384 static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
385 {
386         struct perf_event_mmap_page *pc = mm->userpg;
387 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
388         u64 head = ACCESS_ONCE(pc->aux_head);
389 #else
390         u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
391 #endif
392
393         /* Ensure all reads are done after we read the head */
394         rmb();
395         return head;
396 }
397
398 static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail)
399 {
400         struct perf_event_mmap_page *pc = mm->userpg;
401 #if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
402         u64 old_tail;
403 #endif
404
405         /* Ensure all reads are done before we write the tail out */
406         mb();
407 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
408         pc->aux_tail = tail;
409 #else
410         do {
411                 old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
412         } while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
413 #endif
414 }
415
416 int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
417                         struct auxtrace_mmap_params *mp,
418                         void *userpg, int fd);
419 void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
420 void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
421                                 off_t auxtrace_offset,
422                                 unsigned int auxtrace_pages,
423                                 bool auxtrace_overwrite);
424 void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
425                                    struct perf_evlist *evlist, int idx,
426                                    bool per_cpu);
427
428 typedef int (*process_auxtrace_t)(struct perf_tool *tool,
429                                   union perf_event *event, void *data1,
430                                   size_t len1, void *data2, size_t len2);
431
432 int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr,
433                         struct perf_tool *tool, process_auxtrace_t fn);
434
435 int auxtrace_mmap__read_snapshot(struct auxtrace_mmap *mm,
436                                  struct auxtrace_record *itr,
437                                  struct perf_tool *tool, process_auxtrace_t fn,
438                                  size_t snapshot_size);
439
440 int auxtrace_queues__init(struct auxtrace_queues *queues);
441 int auxtrace_queues__add_event(struct auxtrace_queues *queues,
442                                struct perf_session *session,
443                                union perf_event *event, off_t data_offset,
444                                struct auxtrace_buffer **buffer_ptr);
445 void auxtrace_queues__free(struct auxtrace_queues *queues);
446 int auxtrace_queues__process_index(struct auxtrace_queues *queues,
447                                    struct perf_session *session);
448 struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
449                                               struct auxtrace_buffer *buffer);
450 void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
451 void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
452 void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
453 void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
454
455 int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
456                        u64 ordinal);
457 void auxtrace_heap__pop(struct auxtrace_heap *heap);
458 void auxtrace_heap__free(struct auxtrace_heap *heap);
459
460 struct auxtrace_cache_entry {
461         struct hlist_node hash;
462         u32 key;
463 };
464
465 struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
466                                            unsigned int limit_percent);
467 void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
468 void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
469 void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
470 int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
471                         struct auxtrace_cache_entry *entry);
472 void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
473
474 struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
475                                               int *err);
476
477 int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
478                                     struct record_opts *opts,
479                                     const char *str);
480 int auxtrace_record__options(struct auxtrace_record *itr,
481                              struct perf_evlist *evlist,
482                              struct record_opts *opts);
483 size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
484                                        struct perf_evlist *evlist);
485 int auxtrace_record__info_fill(struct auxtrace_record *itr,
486                                struct perf_session *session,
487                                struct auxtrace_info_event *auxtrace_info,
488                                size_t priv_size);
489 void auxtrace_record__free(struct auxtrace_record *itr);
490 int auxtrace_record__snapshot_start(struct auxtrace_record *itr);
491 int auxtrace_record__snapshot_finish(struct auxtrace_record *itr);
492 int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
493                                    struct auxtrace_mmap *mm,
494                                    unsigned char *data, u64 *head, u64 *old);
495 u64 auxtrace_record__reference(struct auxtrace_record *itr);
496
497 int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
498                                    off_t file_offset);
499 int auxtrace_index__write(int fd, struct list_head *head);
500 int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
501                             bool needs_swap);
502 void auxtrace_index__free(struct list_head *head);
503
504 void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type,
505                           int code, int cpu, pid_t pid, pid_t tid, u64 ip,
506                           const char *msg);
507
508 int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
509                                          struct perf_tool *tool,
510                                          struct perf_session *session,
511                                          perf_event__handler_t process);
512 int perf_event__process_auxtrace_info(struct perf_tool *tool,
513                                       union perf_event *event,
514                                       struct perf_session *session);
515 s64 perf_event__process_auxtrace(struct perf_tool *tool,
516                                  union perf_event *event,
517                                  struct perf_session *session);
518 int perf_event__process_auxtrace_error(struct perf_tool *tool,
519                                        union perf_event *event,
520                                        struct perf_session *session);
521 int itrace_parse_synth_opts(const struct option *opt, const char *str,
522                             int unset);
523 void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts);
524
525 size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
526 void perf_session__auxtrace_error_inc(struct perf_session *session,
527                                       union perf_event *event);
528 void events_stats__auxtrace_error_warn(const struct events_stats *stats);
529
530 void addr_filters__init(struct addr_filters *filts);
531 void addr_filters__exit(struct addr_filters *filts);
532 int addr_filters__parse_bare_filter(struct addr_filters *filts,
533                                     const char *filter);
534 int auxtrace_parse_filters(struct perf_evlist *evlist);
535
536 static inline int auxtrace__process_event(struct perf_session *session,
537                                           union perf_event *event,
538                                           struct perf_sample *sample,
539                                           struct perf_tool *tool)
540 {
541         if (!session->auxtrace)
542                 return 0;
543
544         return session->auxtrace->process_event(session, event, sample, tool);
545 }
546
547 static inline int auxtrace__flush_events(struct perf_session *session,
548                                          struct perf_tool *tool)
549 {
550         if (!session->auxtrace)
551                 return 0;
552
553         return session->auxtrace->flush_events(session, tool);
554 }
555
556 static inline void auxtrace__free_events(struct perf_session *session)
557 {
558         if (!session->auxtrace)
559                 return;
560
561         return session->auxtrace->free_events(session);
562 }
563
564 static inline void auxtrace__free(struct perf_session *session)
565 {
566         if (!session->auxtrace)
567                 return;
568
569         return session->auxtrace->free(session);
570 }
571
572 #else
573
574 static inline struct auxtrace_record *
575 auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
576                       int *err)
577 {
578         *err = 0;
579         return NULL;
580 }
581
582 static inline
583 void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
584 {
585 }
586
587 static inline int
588 perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
589                                      struct perf_tool *tool __maybe_unused,
590                                      struct perf_session *session __maybe_unused,
591                                      perf_event__handler_t process __maybe_unused)
592 {
593         return -EINVAL;
594 }
595
596 static inline
597 int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
598                              struct perf_evlist *evlist __maybe_unused,
599                              struct record_opts *opts __maybe_unused)
600 {
601         return 0;
602 }
603
604 #define perf_event__process_auxtrace_info               0
605 #define perf_event__process_auxtrace                    0
606 #define perf_event__process_auxtrace_error              0
607
608 static inline
609 void perf_session__auxtrace_error_inc(struct perf_session *session
610                                       __maybe_unused,
611                                       union perf_event *event
612                                       __maybe_unused)
613 {
614 }
615
616 static inline
617 void events_stats__auxtrace_error_warn(const struct events_stats *stats
618                                        __maybe_unused)
619 {
620 }
621
622 static inline
623 int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
624                             const char *str __maybe_unused,
625                             int unset __maybe_unused)
626 {
627         pr_err("AUX area tracing not supported\n");
628         return -EINVAL;
629 }
630
631 static inline
632 int auxtrace_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
633                                     struct record_opts *opts __maybe_unused,
634                                     const char *str)
635 {
636         if (!str)
637                 return 0;
638         pr_err("AUX area tracing not supported\n");
639         return -EINVAL;
640 }
641
642 static inline
643 int auxtrace__process_event(struct perf_session *session __maybe_unused,
644                             union perf_event *event __maybe_unused,
645                             struct perf_sample *sample __maybe_unused,
646                             struct perf_tool *tool __maybe_unused)
647 {
648         return 0;
649 }
650
651 static inline
652 int auxtrace__flush_events(struct perf_session *session __maybe_unused,
653                            struct perf_tool *tool __maybe_unused)
654 {
655         return 0;
656 }
657
658 static inline
659 void auxtrace__free_events(struct perf_session *session __maybe_unused)
660 {
661 }
662
663 static inline
664 void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
665 {
666 }
667
668 static inline
669 void auxtrace__free(struct perf_session *session __maybe_unused)
670 {
671 }
672
673 static inline
674 int auxtrace_index__write(int fd __maybe_unused,
675                           struct list_head *head __maybe_unused)
676 {
677         return -EINVAL;
678 }
679
680 static inline
681 int auxtrace_index__process(int fd __maybe_unused,
682                             u64 size __maybe_unused,
683                             struct perf_session *session __maybe_unused,
684                             bool needs_swap __maybe_unused)
685 {
686         return -EINVAL;
687 }
688
689 static inline
690 void auxtrace_index__free(struct list_head *head __maybe_unused)
691 {
692 }
693
694 static inline
695 int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused)
696 {
697         return 0;
698 }
699
700 int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
701                         struct auxtrace_mmap_params *mp,
702                         void *userpg, int fd);
703 void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
704 void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
705                                 off_t auxtrace_offset,
706                                 unsigned int auxtrace_pages,
707                                 bool auxtrace_overwrite);
708 void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
709                                    struct perf_evlist *evlist, int idx,
710                                    bool per_cpu);
711
712 #endif
713
714 #endif