auxtrace.h 20 KB

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