auxtrace.h 20 KB

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