auxtrace.h 20 KB

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