auxtrace.h 22 KB

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