auxtrace.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. struct perf_evlist *evlist);
  279. int (*info_fill)(struct auxtrace_record *itr,
  280. struct perf_session *session,
  281. struct auxtrace_info_event *auxtrace_info,
  282. size_t priv_size);
  283. void (*free)(struct auxtrace_record *itr);
  284. int (*snapshot_start)(struct auxtrace_record *itr);
  285. int (*snapshot_finish)(struct auxtrace_record *itr);
  286. int (*find_snapshot)(struct auxtrace_record *itr, int idx,
  287. struct auxtrace_mmap *mm, unsigned char *data,
  288. u64 *head, u64 *old);
  289. int (*parse_snapshot_options)(struct auxtrace_record *itr,
  290. struct record_opts *opts,
  291. const char *str);
  292. u64 (*reference)(struct auxtrace_record *itr);
  293. int (*read_finish)(struct auxtrace_record *itr, int idx);
  294. unsigned int alignment;
  295. };
  296. #ifdef HAVE_AUXTRACE_SUPPORT
  297. /*
  298. * In snapshot mode the mmapped page is read-only which makes using
  299. * __sync_val_compare_and_swap() problematic. However, snapshot mode expects
  300. * the buffer is not updated while the snapshot is made (e.g. Intel PT disables
  301. * the event) so there is not a race anyway.
  302. */
  303. static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
  304. {
  305. struct perf_event_mmap_page *pc = mm->userpg;
  306. u64 head = ACCESS_ONCE(pc->aux_head);
  307. /* Ensure all reads are done after we read the head */
  308. rmb();
  309. return head;
  310. }
  311. static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
  312. {
  313. struct perf_event_mmap_page *pc = mm->userpg;
  314. #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
  315. u64 head = ACCESS_ONCE(pc->aux_head);
  316. #else
  317. u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
  318. #endif
  319. /* Ensure all reads are done after we read the head */
  320. rmb();
  321. return head;
  322. }
  323. static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail)
  324. {
  325. struct perf_event_mmap_page *pc = mm->userpg;
  326. #if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
  327. u64 old_tail;
  328. #endif
  329. /* Ensure all reads are done before we write the tail out */
  330. mb();
  331. #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
  332. pc->aux_tail = tail;
  333. #else
  334. do {
  335. old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
  336. } while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
  337. #endif
  338. }
  339. int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
  340. struct auxtrace_mmap_params *mp,
  341. void *userpg, int fd);
  342. void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
  343. void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
  344. off_t auxtrace_offset,
  345. unsigned int auxtrace_pages,
  346. bool auxtrace_overwrite);
  347. void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
  348. struct perf_evlist *evlist, int idx,
  349. bool per_cpu);
  350. typedef int (*process_auxtrace_t)(struct perf_tool *tool,
  351. union perf_event *event, void *data1,
  352. size_t len1, void *data2, size_t len2);
  353. int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr,
  354. struct perf_tool *tool, process_auxtrace_t fn);
  355. int auxtrace_mmap__read_snapshot(struct auxtrace_mmap *mm,
  356. struct auxtrace_record *itr,
  357. struct perf_tool *tool, process_auxtrace_t fn,
  358. size_t snapshot_size);
  359. int auxtrace_queues__init(struct auxtrace_queues *queues);
  360. int auxtrace_queues__add_event(struct auxtrace_queues *queues,
  361. struct perf_session *session,
  362. union perf_event *event, off_t data_offset,
  363. struct auxtrace_buffer **buffer_ptr);
  364. void auxtrace_queues__free(struct auxtrace_queues *queues);
  365. int auxtrace_queues__process_index(struct auxtrace_queues *queues,
  366. struct perf_session *session);
  367. struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
  368. struct auxtrace_buffer *buffer);
  369. void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
  370. void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
  371. void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
  372. void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
  373. int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
  374. u64 ordinal);
  375. void auxtrace_heap__pop(struct auxtrace_heap *heap);
  376. void auxtrace_heap__free(struct auxtrace_heap *heap);
  377. struct auxtrace_cache_entry {
  378. struct hlist_node hash;
  379. u32 key;
  380. };
  381. struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
  382. unsigned int limit_percent);
  383. void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
  384. void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
  385. void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
  386. int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
  387. struct auxtrace_cache_entry *entry);
  388. void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
  389. struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
  390. int *err);
  391. int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
  392. struct record_opts *opts,
  393. const char *str);
  394. int auxtrace_record__options(struct auxtrace_record *itr,
  395. struct perf_evlist *evlist,
  396. struct record_opts *opts);
  397. size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
  398. struct perf_evlist *evlist);
  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)
  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