16 #ifndef __PERF_AUXTRACE_H 17 #define __PERF_AUXTRACE_H 19 #include <sys/types.h> 23 #include <linux/list.h> 24 #include <linux/perf_event.h> 25 #include <linux/types.h> 115 #define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256 125 struct list_head list;
176 struct list_head list;
203 struct list_head head;
322 u64 *head, u64 *old);
349 struct list_head list;
369 struct list_head head;
373 #ifdef HAVE_AUXTRACE_SUPPORT 381 static inline u64 auxtrace_mmap__read_snapshot_head(
struct auxtrace_mmap *mm)
383 struct perf_event_mmap_page *pc = mm->
userpg;
384 u64 head = READ_ONCE(pc->aux_head);
391 static inline u64 auxtrace_mmap__read_head(
struct auxtrace_mmap *mm)
393 struct perf_event_mmap_page *pc = mm->
userpg;
394 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) 395 u64 head = READ_ONCE(pc->aux_head);
397 u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
405 static inline void auxtrace_mmap__write_tail(
struct auxtrace_mmap *mm, u64 tail)
407 struct perf_event_mmap_page *pc = mm->
userpg;
408 #if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) 414 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) 418 old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
419 }
while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
425 void *userpg,
int fd);
428 off_t auxtrace_offset,
429 unsigned int auxtrace_pages,
430 bool auxtrace_overwrite);
437 size_t len1,
void *data2,
size_t len2);
440 struct perf_tool *tool, process_auxtrace_t fn);
444 struct perf_tool *tool, process_auxtrace_t fn,
445 size_t snapshot_size);
467 struct auxtrace_cache_entry {
468 struct hlist_node hash;
473 unsigned int limit_percent);
478 struct auxtrace_cache_entry *
entry);
501 unsigned char *
data, u64 *head, u64 *old);
512 int code,
int cpu, pid_t
pid, pid_t tid, u64 ip,
611 #define perf_event__process_auxtrace_info 0 612 #define perf_event__process_auxtrace 0 613 #define perf_event__process_auxtrace_error 0 631 const char *
str __maybe_unused,
632 int unset __maybe_unused)
634 pr_err(
"AUX area tracing not supported\n");
645 pr_err(
"AUX area tracing not supported\n");
682 struct list_head *head __maybe_unused)
689 u64
size __maybe_unused,
691 bool needs_swap __maybe_unused)
709 void *userpg,
int fd);
712 off_t auxtrace_offset,
713 unsigned int auxtrace_pages,
714 bool auxtrace_overwrite);
static int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, struct perf_evlist *evlist __maybe_unused, struct record_opts *opts __maybe_unused)
void auxtrace_cache__free_entry(struct auxtrace_cache *c __maybe_unused, void *entry)
int(* snapshot_start)(struct auxtrace_record *itr)
int(* process_event)(struct perf_session *session, union perf_event *event, struct perf_sample *sample, struct perf_tool *tool)
int(* perf_event__handler_t)(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int auxtrace_queues__process_index(struct auxtrace_queues *queues, struct perf_session *session)
static void auxtrace__free(struct perf_session *session __maybe_unused)
void auxtrace_buffer__free(struct auxtrace_buffer *buffer)
void * auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd)
struct auxtrace_queue * queue_array
static void auxtrace_index__free(struct list_head *head __maybe_unused)
struct auxtrace * auxtrace
static void auxtrace__free_events(struct perf_session *session __maybe_unused)
void addr_filters__exit(struct addr_filters *filts)
struct auxtrace_heap_item * heap_array
unsigned int callchain_sz
static void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
struct auxtrace_buffer * auxtrace_buffer__next(struct auxtrace_queue *queue, struct auxtrace_buffer *buffer)
int(* snapshot_finish)(struct auxtrace_record *itr)
static void process_event(struct perf_script *script, struct perf_sample *sample, struct perf_evsel *evsel, struct addr_location *al, struct machine *machine)
void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type, int code, int cpu, pid_t pid, pid_t tid, u64 ip, const char *msg)
size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp)
int auxtrace_queues__add_event(struct auxtrace_queues *queues, struct perf_session *session, union perf_event *event, off_t data_offset, struct auxtrace_buffer **buffer_ptr)
static struct auxtrace_record * auxtrace_record__init(struct perf_evlist *evlist __maybe_unused, int *err)
int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr, struct perf_tool *tool, process_auxtrace_t fn)
static int auxtrace__process_event(struct perf_session *session __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct perf_tool *tool __maybe_unused)
int auxtrace_cache__add(struct auxtrace_cache *c, u32 key, struct auxtrace_cache_entry *entry)
int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx, struct auxtrace_mmap *mm, unsigned char *data, u64 *head, u64 *old)
int auxtrace_record__snapshot_finish(struct auxtrace_record *itr)
#define perf_event__process_auxtrace_error
void addr_filters__init(struct addr_filters *filts)
void auxtrace_mmap__munmap(struct auxtrace_mmap *mm)
int auxtrace_record__info_fill(struct auxtrace_record *itr, struct perf_session *session, struct auxtrace_info_event *auxtrace_info, size_t priv_size)
int(* read_finish)(struct auxtrace_record *itr, int idx)
int auxtrace_record__snapshot_start(struct auxtrace_record *itr)
static struct perf_session * session
void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer)
static int entry(u64 ip, struct unwind_info *ui)
void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, struct perf_evlist *evlist, int idx, bool per_cpu)
void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts)
static struct perf_tool tool
static int str(yyscan_t scanner, int token)
static int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused, struct perf_tool *tool __maybe_unused, struct perf_session *session __maybe_unused, perf_event__handler_t process __maybe_unused)
void auxtrace_heap__free(struct auxtrace_heap *heap)
unsigned long long period
struct auxtrace_cache * auxtrace_cache__new(unsigned int bits, size_t entry_size, unsigned int limit_percent)
#define PERF_AUXTRACE_INDEX_ENTRY_COUNT
void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer)
static int auxtrace_index__write(int fd __maybe_unused, struct list_head *head __maybe_unused)
int auxtrace_mmap__read_snapshot(struct auxtrace_mmap *mm, struct auxtrace_record *itr, struct perf_tool *tool, process_auxtrace_t fn, size_t snapshot_size)
static int auxtrace_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused, struct record_opts *opts __maybe_unused, const char *str)
#define perf_event__process_auxtrace_info
int(* find_snapshot)(struct auxtrace_record *itr, int idx, struct auxtrace_mmap *mm, unsigned char *data, u64 *head, u64 *old)
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, struct auxtrace_mmap_params *mp, void *userpg, int fd)
void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp, off_t auxtrace_offset, unsigned int auxtrace_pages, bool auxtrace_overwrite)
unsigned int last_branch_sz
#define perf_event__process_auxtrace
static int auxtrace__flush_events(struct perf_session *session __maybe_unused, struct perf_tool *tool __maybe_unused)
unsigned long initial_skip
void * auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key)
struct strfilter * filter
void(* free_events)(struct perf_session *session)
int(* flush_events)(struct perf_session *session, struct perf_tool *tool)
static int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused)
unsigned long * cpu_bitmap
static void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
static void events_stats__auxtrace_error_warn(const struct events_stats *stats __maybe_unused)
u64 auxtrace_record__reference(struct auxtrace_record *itr)
void auxtrace_heap__pop(struct auxtrace_heap *heap)
int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event, off_t file_offset)
void auxtrace_queues__free(struct auxtrace_queues *queues)
int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr, u64 ordinal)
void(* free)(struct perf_session *session)
int auxtrace_queues__init(struct auxtrace_queues *queues)
static int auxtrace_index__process(int fd __maybe_unused, u64 size __maybe_unused, struct perf_session *session __maybe_unused, bool needs_swap __maybe_unused)
void * auxtrace_cache__alloc_entry(struct auxtrace_cache *c)
static void perf_session__auxtrace_error_inc(struct perf_session *session __maybe_unused, union perf_event *event __maybe_unused)
static int itrace_parse_synth_opts(const struct option *opt __maybe_unused, const char *str __maybe_unused, int unset __maybe_unused)
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr, struct perf_evlist *evlist)
int addr_filters__parse_bare_filter(struct addr_filters *filts, const char *filter)
enum itrace_period_type period_type