Linux Perf
|
#include "util.h"
#include <api/fs/fs.h>
#include <errno.h>
#include <inttypes.h>
#include <poll.h>
#include "cpumap.h"
#include "thread_map.h"
#include "target.h"
#include "evlist.h"
#include "evsel.h"
#include "debug.h"
#include "units.h"
#include "asm/bug.h"
#include <signal.h>
#include <unistd.h>
#include "parse-events.h"
#include <subcmd/parse-options.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/bitops.h>
#include <linux/hash.h>
#include <linux/log2.h>
#include <linux/err.h>
Go to the source code of this file.
Macros | |
#define | FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
#define | SID(e, x, y) xyarray__entry(e->sample_id, x, y) |
Functions | |
void | perf_evlist__init (struct perf_evlist *evlist, struct cpu_map *cpus, struct thread_map *threads) |
struct perf_evlist * | perf_evlist__new (void) |
struct perf_evlist * | perf_evlist__new_default (void) |
struct perf_evlist * | perf_evlist__new_dummy (void) |
void | perf_evlist__set_id_pos (struct perf_evlist *evlist) |
static void | perf_evlist__update_id_pos (struct perf_evlist *evlist) |
static void | perf_evlist__purge (struct perf_evlist *evlist) |
void | perf_evlist__exit (struct perf_evlist *evlist) |
void | perf_evlist__delete (struct perf_evlist *evlist) |
static void | __perf_evlist__propagate_maps (struct perf_evlist *evlist, struct perf_evsel *evsel) |
static void | perf_evlist__propagate_maps (struct perf_evlist *evlist) |
void | perf_evlist__add (struct perf_evlist *evlist, struct perf_evsel *entry) |
void | perf_evlist__remove (struct perf_evlist *evlist, struct perf_evsel *evsel) |
void | perf_evlist__splice_list_tail (struct perf_evlist *evlist, struct list_head *list) |
void | __perf_evlist__set_leader (struct list_head *list) |
void | perf_evlist__set_leader (struct perf_evlist *evlist) |
void | perf_event_attr__set_max_precise_ip (struct perf_event_attr *attr) |
int | __perf_evlist__add_default (struct perf_evlist *evlist, bool precise) |
int | perf_evlist__add_dummy (struct perf_evlist *evlist) |
static int | perf_evlist__add_attrs (struct perf_evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs) |
int | __perf_evlist__add_default_attrs (struct perf_evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs) |
struct perf_evsel * | perf_evlist__find_tracepoint_by_id (struct perf_evlist *evlist, int id) |
struct perf_evsel * | perf_evlist__find_tracepoint_by_name (struct perf_evlist *evlist, const char *name) |
int | perf_evlist__add_newtp (struct perf_evlist *evlist, const char *sys, const char *name, void *handler) |
static int | perf_evlist__nr_threads (struct perf_evlist *evlist, struct perf_evsel *evsel) |
void | perf_evlist__disable (struct perf_evlist *evlist) |
void | perf_evlist__enable (struct perf_evlist *evlist) |
void | perf_evlist__toggle_enable (struct perf_evlist *evlist) |
static int | perf_evlist__enable_event_cpu (struct perf_evlist *evlist, struct perf_evsel *evsel, int cpu) |
static int | perf_evlist__enable_event_thread (struct perf_evlist *evlist, struct perf_evsel *evsel, int thread) |
int | perf_evlist__enable_event_idx (struct perf_evlist *evlist, struct perf_evsel *evsel, int idx) |
int | perf_evlist__alloc_pollfd (struct perf_evlist *evlist) |
static int | __perf_evlist__add_pollfd (struct perf_evlist *evlist, int fd, struct perf_mmap *map, short revent) |
int | perf_evlist__add_pollfd (struct perf_evlist *evlist, int fd) |
static void | perf_evlist__munmap_filtered (struct fdarray *fda, int fd, void *arg __maybe_unused) |
int | perf_evlist__filter_pollfd (struct perf_evlist *evlist, short revents_and_mask) |
int | perf_evlist__poll (struct perf_evlist *evlist, int timeout) |
static void | perf_evlist__id_hash (struct perf_evlist *evlist, struct perf_evsel *evsel, int cpu, int thread, u64 id) |
void | perf_evlist__id_add (struct perf_evlist *evlist, struct perf_evsel *evsel, int cpu, int thread, u64 id) |
int | perf_evlist__id_add_fd (struct perf_evlist *evlist, struct perf_evsel *evsel, int cpu, int thread, int fd) |
static void | perf_evlist__set_sid_idx (struct perf_evlist *evlist, struct perf_evsel *evsel, int idx, int cpu, int thread) |
struct perf_sample_id * | perf_evlist__id2sid (struct perf_evlist *evlist, u64 id) |
struct perf_evsel * | perf_evlist__id2evsel (struct perf_evlist *evlist, u64 id) |
struct perf_evsel * | perf_evlist__id2evsel_strict (struct perf_evlist *evlist, u64 id) |
static int | perf_evlist__event2id (struct perf_evlist *evlist, union perf_event *event, u64 *id) |
struct perf_evsel * | perf_evlist__event2evsel (struct perf_evlist *evlist, union perf_event *event) |
static int | perf_evlist__set_paused (struct perf_evlist *evlist, bool value) |
static int | perf_evlist__pause (struct perf_evlist *evlist) |
static int | perf_evlist__resume (struct perf_evlist *evlist) |
static void | perf_evlist__munmap_nofree (struct perf_evlist *evlist) |
void | perf_evlist__munmap (struct perf_evlist *evlist) |
static struct perf_mmap * | perf_evlist__alloc_mmap (struct perf_evlist *evlist, bool overwrite) |
static bool | perf_evlist__should_poll (struct perf_evlist *evlist __maybe_unused, struct perf_evsel *evsel) |
static int | perf_evlist__mmap_per_evsel (struct perf_evlist *evlist, int idx, struct mmap_params *mp, int cpu_idx, int thread, int *_output, int *_output_overwrite) |
static int | perf_evlist__mmap_per_cpu (struct perf_evlist *evlist, struct mmap_params *mp) |
static int | perf_evlist__mmap_per_thread (struct perf_evlist *evlist, struct mmap_params *mp) |
unsigned long | perf_event_mlock_kb_in_pages (void) |
size_t | perf_evlist__mmap_size (unsigned long pages) |
static long | parse_pages_arg (const char *str, unsigned long min, unsigned long max) |
int | __perf_evlist__parse_mmap_pages (unsigned int *mmap_pages, const char *str) |
int | perf_evlist__parse_mmap_pages (const struct option *opt, const char *str, int unset __maybe_unused) |
int | perf_evlist__mmap_ex (struct perf_evlist *evlist, unsigned int pages, unsigned int auxtrace_pages, bool auxtrace_overwrite) |
int | perf_evlist__mmap (struct perf_evlist *evlist, unsigned int pages) |
int | perf_evlist__create_maps (struct perf_evlist *evlist, struct target *target) |
void | perf_evlist__set_maps (struct perf_evlist *evlist, struct cpu_map *cpus, struct thread_map *threads) |
void | __perf_evlist__set_sample_bit (struct perf_evlist *evlist, enum perf_event_sample_format bit) |
void | __perf_evlist__reset_sample_bit (struct perf_evlist *evlist, enum perf_event_sample_format bit) |
int | perf_evlist__apply_filters (struct perf_evlist *evlist, struct perf_evsel **err_evsel) |
int | perf_evlist__set_filter (struct perf_evlist *evlist, const char *filter) |
int | perf_evlist__set_filter_pids (struct perf_evlist *evlist, size_t npids, pid_t *pids) |
int | perf_evlist__set_filter_pid (struct perf_evlist *evlist, pid_t pid) |
bool | perf_evlist__valid_sample_type (struct perf_evlist *evlist) |
u64 | __perf_evlist__combined_sample_type (struct perf_evlist *evlist) |
u64 | perf_evlist__combined_sample_type (struct perf_evlist *evlist) |
u64 | perf_evlist__combined_branch_type (struct perf_evlist *evlist) |
bool | perf_evlist__valid_read_format (struct perf_evlist *evlist) |
u64 | perf_evlist__read_format (struct perf_evlist *evlist) |
u16 | perf_evlist__id_hdr_size (struct perf_evlist *evlist) |
bool | perf_evlist__valid_sample_id_all (struct perf_evlist *evlist) |
bool | perf_evlist__sample_id_all (struct perf_evlist *evlist) |
void | perf_evlist__set_selected (struct perf_evlist *evlist, struct perf_evsel *evsel) |
void | perf_evlist__close (struct perf_evlist *evlist) |
static int | perf_evlist__create_syswide_maps (struct perf_evlist *evlist) |
int | perf_evlist__open (struct perf_evlist *evlist) |
int | perf_evlist__prepare_workload (struct perf_evlist *evlist, struct target *target, const char *argv[], bool pipe_output, void(*exec_error)(int signo, siginfo_t *info, void *ucontext)) |
int | perf_evlist__start_workload (struct perf_evlist *evlist) |
int | perf_evlist__parse_sample (struct perf_evlist *evlist, union perf_event *event, struct perf_sample *sample) |
int | perf_evlist__parse_sample_timestamp (struct perf_evlist *evlist, union perf_event *event, u64 *timestamp) |
size_t | perf_evlist__fprintf (struct perf_evlist *evlist, FILE *fp) |
int | perf_evlist__strerror_open (struct perf_evlist *evlist, int err, char *buf, size_t size) |
int | perf_evlist__strerror_mmap (struct perf_evlist *evlist, int err, char *buf, size_t size) |
void | perf_evlist__to_front (struct perf_evlist *evlist, struct perf_evsel *move_evsel) |
void | perf_evlist__set_tracking_event (struct perf_evlist *evlist, struct perf_evsel *tracking_evsel) |
struct perf_evsel * | perf_evlist__find_evsel_by_str (struct perf_evlist *evlist, const char *str) |
void | perf_evlist__toggle_bkw_mmap (struct perf_evlist *evlist, enum bkw_mmap_state state) |
bool | perf_evlist__exclude_kernel (struct perf_evlist *evlist) |
void | perf_evlist__force_leader (struct perf_evlist *evlist) |
#define FD | ( | e, | |
x, | |||
y | |||
) | (*(int *)xyarray__entry(e->fd, x, y)) |
#define SID | ( | e, | |
x, | |||
y | |||
) | xyarray__entry(e->sample_id, x, y) |
int __perf_evlist__add_default | ( | struct perf_evlist * | evlist, |
bool | precise | ||
) |
int __perf_evlist__add_default_attrs | ( | struct perf_evlist * | evlist, |
struct perf_event_attr * | attrs, | ||
size_t | nr_attrs | ||
) |
|
static |
u64 __perf_evlist__combined_sample_type | ( | struct perf_evlist * | evlist | ) |
int __perf_evlist__parse_mmap_pages | ( | unsigned int * | mmap_pages, |
const char * | str | ||
) |
|
static |
void __perf_evlist__reset_sample_bit | ( | struct perf_evlist * | evlist, |
enum perf_event_sample_format | bit | ||
) |
void __perf_evlist__set_sample_bit | ( | struct perf_evlist * | evlist, |
enum perf_event_sample_format | bit | ||
) |
|
static |
void perf_event_attr__set_max_precise_ip | ( | struct perf_event_attr * | attr | ) |
void perf_evlist__add | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | entry | ||
) |
|
static |
int perf_evlist__add_dummy | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__add_newtp | ( | struct perf_evlist * | evlist, |
const char * | sys, | ||
const char * | name, | ||
void * | handler | ||
) |
int perf_evlist__add_pollfd | ( | struct perf_evlist * | evlist, |
int | fd | ||
) |
|
static |
int perf_evlist__alloc_pollfd | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__apply_filters | ( | struct perf_evlist * | evlist, |
struct perf_evsel ** | err_evsel | ||
) |
void perf_evlist__close | ( | struct perf_evlist * | evlist | ) |
u64 perf_evlist__combined_branch_type | ( | struct perf_evlist * | evlist | ) |
u64 perf_evlist__combined_sample_type | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__create_maps | ( | struct perf_evlist * | evlist, |
struct target * | target | ||
) |
|
static |
void perf_evlist__delete | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__disable | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__enable | ( | struct perf_evlist * | evlist | ) |
|
static |
int perf_evlist__enable_event_idx | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | evsel, | ||
int | idx | ||
) |
|
static |
struct perf_evsel* perf_evlist__event2evsel | ( | struct perf_evlist * | evlist, |
union perf_event * | event | ||
) |
|
static |
bool perf_evlist__exclude_kernel | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__exit | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__filter_pollfd | ( | struct perf_evlist * | evlist, |
short | revents_and_mask | ||
) |
struct perf_evsel* perf_evlist__find_evsel_by_str | ( | struct perf_evlist * | evlist, |
const char * | str | ||
) |
struct perf_evsel* perf_evlist__find_tracepoint_by_id | ( | struct perf_evlist * | evlist, |
int | id | ||
) |
struct perf_evsel* perf_evlist__find_tracepoint_by_name | ( | struct perf_evlist * | evlist, |
const char * | name | ||
) |
void perf_evlist__force_leader | ( | struct perf_evlist * | evlist | ) |
size_t perf_evlist__fprintf | ( | struct perf_evlist * | evlist, |
FILE * | fp | ||
) |
struct perf_evsel* perf_evlist__id2evsel | ( | struct perf_evlist * | evlist, |
u64 | id | ||
) |
struct perf_evsel* perf_evlist__id2evsel_strict | ( | struct perf_evlist * | evlist, |
u64 | id | ||
) |
struct perf_sample_id* perf_evlist__id2sid | ( | struct perf_evlist * | evlist, |
u64 | id | ||
) |
void perf_evlist__id_add | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | evsel, | ||
int | cpu, | ||
int | thread, | ||
u64 | id | ||
) |
int perf_evlist__id_add_fd | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | evsel, | ||
int | cpu, | ||
int | thread, | ||
int | fd | ||
) |
|
static |
u16 perf_evlist__id_hdr_size | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__init | ( | struct perf_evlist * | evlist, |
struct cpu_map * | cpus, | ||
struct thread_map * | threads | ||
) |
int perf_evlist__mmap | ( | struct perf_evlist * | evlist, |
unsigned int | pages | ||
) |
int perf_evlist__mmap_ex | ( | struct perf_evlist * | evlist, |
unsigned int | pages, | ||
unsigned int | auxtrace_pages, | ||
bool | auxtrace_overwrite | ||
) |
perf_evlist__mmap_ex - Create mmaps to receive events. : list of events : map length in pages : overwrite older events? - auxtrace map length in pages - overwrite older auxtrace data?
If is false the user needs to signal event consumption using perf_mmap__write_tail(). Using perf_evlist__mmap_read() does this automatically.
Similarly, if is false the user needs to signal data consumption using auxtrace_mmap__write_tail().
Return: %0 on success, negative error code otherwise.
Definition at line 1019 of file evlist.c.
|
static |
|
static |
|
static |
size_t perf_evlist__mmap_size | ( | unsigned long | pages | ) |
void perf_evlist__munmap | ( | struct perf_evlist * | evlist | ) |
|
static |
|
static |
struct perf_evlist* perf_evlist__new | ( | void | ) |
struct perf_evlist* perf_evlist__new_default | ( | void | ) |
struct perf_evlist* perf_evlist__new_dummy | ( | void | ) |
|
static |
int perf_evlist__open | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__parse_mmap_pages | ( | const struct option * | opt, |
const char * | str, | ||
int unset | __maybe_unused | ||
) |
int perf_evlist__parse_sample | ( | struct perf_evlist * | evlist, |
union perf_event * | event, | ||
struct perf_sample * | sample | ||
) |
int perf_evlist__parse_sample_timestamp | ( | struct perf_evlist * | evlist, |
union perf_event * | event, | ||
u64 * | timestamp | ||
) |
|
static |
int perf_evlist__poll | ( | struct perf_evlist * | evlist, |
int | timeout | ||
) |
int perf_evlist__prepare_workload | ( | struct perf_evlist * | evlist, |
struct target * | target, | ||
const char * | argv[], | ||
bool | pipe_output, | ||
void(*)(int signo, siginfo_t *info, void *ucontext) | exec_error | ||
) |
|
static |
|
static |
u64 perf_evlist__read_format | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__remove | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | evsel | ||
) |
|
static |
bool perf_evlist__sample_id_all | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__set_filter | ( | struct perf_evlist * | evlist, |
const char * | filter | ||
) |
int perf_evlist__set_filter_pid | ( | struct perf_evlist * | evlist, |
pid_t | pid | ||
) |
int perf_evlist__set_filter_pids | ( | struct perf_evlist * | evlist, |
size_t | npids, | ||
pid_t * | pids | ||
) |
void perf_evlist__set_id_pos | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__set_leader | ( | struct perf_evlist * | evlist | ) |
void perf_evlist__set_maps | ( | struct perf_evlist * | evlist, |
struct cpu_map * | cpus, | ||
struct thread_map * | threads | ||
) |
|
static |
void perf_evlist__set_selected | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | evsel | ||
) |
|
static |
void perf_evlist__set_tracking_event | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | tracking_evsel | ||
) |
|
static |
void perf_evlist__splice_list_tail | ( | struct perf_evlist * | evlist, |
struct list_head * | list | ||
) |
int perf_evlist__start_workload | ( | struct perf_evlist * | evlist | ) |
int perf_evlist__strerror_mmap | ( | struct perf_evlist * | evlist, |
int | err, | ||
char * | buf, | ||
size_t | size | ||
) |
int perf_evlist__strerror_open | ( | struct perf_evlist * | evlist, |
int | err, | ||
char * | buf, | ||
size_t | size | ||
) |
void perf_evlist__to_front | ( | struct perf_evlist * | evlist, |
struct perf_evsel * | move_evsel | ||
) |
void perf_evlist__toggle_bkw_mmap | ( | struct perf_evlist * | evlist, |
enum bkw_mmap_state | state | ||
) |
void perf_evlist__toggle_enable | ( | struct perf_evlist * | evlist | ) |
|
static |
bool perf_evlist__valid_read_format | ( | struct perf_evlist * | evlist | ) |
bool perf_evlist__valid_sample_id_all | ( | struct perf_evlist * | evlist | ) |
bool perf_evlist__valid_sample_type | ( | struct perf_evlist * | evlist | ) |