2011-01-11 20:56:53 -02:00
|
|
|
#ifndef __PERF_EVLIST_H
|
|
|
|
|
#define __PERF_EVLIST_H 1
|
|
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
2011-11-04 09:10:59 -02:00
|
|
|
#include <stdio.h>
|
2011-01-12 22:39:13 -02:00
|
|
|
#include "../perf.h"
|
2011-01-15 10:40:59 -02:00
|
|
|
#include "event.h"
|
2011-11-04 09:10:59 -02:00
|
|
|
#include "util.h"
|
2011-11-09 08:47:15 -02:00
|
|
|
#include <unistd.h>
|
2011-01-11 20:56:53 -02:00
|
|
|
|
2011-01-11 22:30:02 -02:00
|
|
|
struct pollfd;
|
2011-01-30 10:46:46 -02:00
|
|
|
struct thread_map;
|
|
|
|
|
struct cpu_map;
|
2011-11-08 14:41:57 -02:00
|
|
|
struct perf_record_opts;
|
2011-01-11 22:30:02 -02:00
|
|
|
|
2011-01-12 22:39:13 -02:00
|
|
|
#define PERF_EVLIST__HLIST_BITS 8
|
|
|
|
|
#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
|
|
|
|
|
|
2011-01-11 20:56:53 -02:00
|
|
|
struct perf_evlist {
|
|
|
|
|
struct list_head entries;
|
2011-01-12 22:39:13 -02:00
|
|
|
struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
|
2011-01-11 20:56:53 -02:00
|
|
|
int nr_entries;
|
2011-01-11 22:30:02 -02:00
|
|
|
int nr_fds;
|
2011-05-15 09:39:00 -03:00
|
|
|
int nr_mmaps;
|
2011-01-12 22:39:13 -02:00
|
|
|
int mmap_len;
|
2011-11-09 08:47:15 -02:00
|
|
|
struct {
|
|
|
|
|
int cork_fd;
|
|
|
|
|
pid_t pid;
|
|
|
|
|
} workload;
|
2011-01-29 09:08:13 -02:00
|
|
|
bool overwrite;
|
2011-01-29 14:01:45 -02:00
|
|
|
union perf_event event_copy;
|
2011-01-12 22:39:13 -02:00
|
|
|
struct perf_mmap *mmap;
|
2011-01-11 22:30:02 -02:00
|
|
|
struct pollfd *pollfd;
|
2011-01-30 11:59:43 -02:00
|
|
|
struct thread_map *threads;
|
|
|
|
|
struct cpu_map *cpus;
|
2011-10-05 19:11:32 -03:00
|
|
|
struct perf_evsel *selected;
|
2011-01-11 20:56:53 -02:00
|
|
|
};
|
|
|
|
|
|
2011-11-28 17:57:40 -02:00
|
|
|
struct perf_evsel_str_handler {
|
|
|
|
|
const char *name;
|
|
|
|
|
void *handler;
|
|
|
|
|
};
|
|
|
|
|
|
2011-01-11 20:56:53 -02:00
|
|
|
struct perf_evsel;
|
|
|
|
|
|
2011-01-30 11:59:43 -02:00
|
|
|
struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
|
|
|
|
|
struct thread_map *threads);
|
|
|
|
|
void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
|
|
|
|
|
struct thread_map *threads);
|
2011-01-18 21:41:45 -02:00
|
|
|
void perf_evlist__exit(struct perf_evlist *evlist);
|
2011-01-11 20:56:53 -02:00
|
|
|
void perf_evlist__delete(struct perf_evlist *evlist);
|
|
|
|
|
|
|
|
|
|
void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
|
|
|
|
|
int perf_evlist__add_default(struct perf_evlist *evlist);
|
2011-11-04 09:10:59 -02:00
|
|
|
int perf_evlist__add_attrs(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_event_attr *attrs, size_t nr_attrs);
|
2012-05-30 13:53:54 -03:00
|
|
|
int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_event_attr *attrs, size_t nr_attrs);
|
2011-11-05 08:41:51 -02:00
|
|
|
int perf_evlist__add_tracepoints(struct perf_evlist *evlist,
|
|
|
|
|
const char *tracepoints[], size_t nr_tracepoints);
|
2011-11-28 17:57:40 -02:00
|
|
|
int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
|
|
|
|
|
const struct perf_evsel_str_handler *assocs,
|
|
|
|
|
size_t nr_assocs);
|
2011-11-04 09:10:59 -02:00
|
|
|
|
|
|
|
|
#define perf_evlist__add_attrs_array(evlist, array) \
|
|
|
|
|
perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
|
2012-05-30 13:53:54 -03:00
|
|
|
#define perf_evlist__add_default_attrs(evlist, array) \
|
|
|
|
|
__perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array))
|
2011-01-11 20:56:53 -02:00
|
|
|
|
2011-11-05 08:41:51 -02:00
|
|
|
#define perf_evlist__add_tracepoints_array(evlist, array) \
|
|
|
|
|
perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
|
|
|
|
|
|
2011-11-28 17:57:40 -02:00
|
|
|
#define perf_evlist__set_tracepoints_handlers_array(evlist, array) \
|
|
|
|
|
perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))
|
|
|
|
|
|
2011-03-10 11:15:54 -03:00
|
|
|
void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
|
|
|
|
|
int cpu, int thread, u64 id);
|
2011-03-04 22:29:39 -03:00
|
|
|
|
2011-01-12 17:03:24 -02:00
|
|
|
void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
|
2011-01-11 22:30:02 -02:00
|
|
|
|
2011-01-12 22:39:13 -02:00
|
|
|
struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
|
|
|
|
|
|
2011-05-15 09:39:00 -03:00
|
|
|
union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
|
2011-01-15 10:40:59 -02:00
|
|
|
|
2011-10-25 10:42:19 -02:00
|
|
|
int perf_evlist__open(struct perf_evlist *evlist, bool group);
|
|
|
|
|
|
2011-11-08 14:41:57 -02:00
|
|
|
void perf_evlist__config_attrs(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_record_opts *opts);
|
|
|
|
|
|
2011-11-09 08:47:15 -02:00
|
|
|
int perf_evlist__prepare_workload(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_record_opts *opts,
|
|
|
|
|
const char *argv[]);
|
|
|
|
|
int perf_evlist__start_workload(struct perf_evlist *evlist);
|
|
|
|
|
|
2011-11-09 09:10:47 -02:00
|
|
|
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
|
|
|
|
|
bool overwrite);
|
2011-01-30 11:59:43 -02:00
|
|
|
void perf_evlist__munmap(struct perf_evlist *evlist);
|
|
|
|
|
|
2011-07-25 11:06:19 -03:00
|
|
|
void perf_evlist__disable(struct perf_evlist *evlist);
|
2011-08-25 10:17:55 -06:00
|
|
|
void perf_evlist__enable(struct perf_evlist *evlist);
|
2011-07-25 11:06:19 -03:00
|
|
|
|
2011-10-05 19:11:32 -03:00
|
|
|
void perf_evlist__set_selected(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_evsel *evsel);
|
|
|
|
|
|
2011-01-30 11:59:43 -02:00
|
|
|
static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
|
|
|
|
|
struct cpu_map *cpus,
|
|
|
|
|
struct thread_map *threads)
|
|
|
|
|
{
|
|
|
|
|
evlist->cpus = cpus;
|
|
|
|
|
evlist->threads = threads;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-26 14:15:19 +09:00
|
|
|
int perf_evlist__create_maps(struct perf_evlist *evlist,
|
|
|
|
|
struct perf_target *target);
|
2011-01-30 11:59:43 -02:00
|
|
|
void perf_evlist__delete_maps(struct perf_evlist *evlist);
|
2011-02-26 04:51:54 +01:00
|
|
|
int perf_evlist__set_filters(struct perf_evlist *evlist);
|
2011-01-30 10:46:46 -02:00
|
|
|
|
2011-06-02 11:04:54 -03:00
|
|
|
u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
|
|
|
|
|
bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
|
2011-11-11 22:28:50 -02:00
|
|
|
u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist);
|
2011-05-21 17:49:00 +02:00
|
|
|
|
2011-06-02 11:04:54 -03:00
|
|
|
bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
|
|
|
|
|
bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
|
2012-01-27 15:34:20 +01:00
|
|
|
|
|
|
|
|
void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
|
|
|
|
|
struct list_head *list,
|
|
|
|
|
int nr_entries);
|
|
|
|
|
|
2011-01-11 20:56:53 -02:00
|
|
|
#endif /* __PERF_EVLIST_H */
|