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