evlist.h 1.7 KB
Newer Older
1 2 3 4
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LIBPERF_INTERNAL_EVLIST_H
#define __LIBPERF_INTERNAL_EVLIST_H

5
#include <linux/list.h>
6
#include <api/fd/array.h>
7

8 9 10
#define PERF_EVLIST__HLIST_BITS 8
#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)

11
struct perf_cpu_map;
12
struct perf_thread_map;
13

14
struct perf_evlist {
15 16 17 18
	struct list_head	 entries;
	int			 nr_entries;
	bool			 has_user_cpus;
	struct perf_cpu_map	*cpus;
19
	struct perf_thread_map	*threads;
20
	int			 nr_mmaps;
21
	size_t			 mmap_len;
22
	struct fdarray		 pollfd;
23
	struct hlist_head	 heads[PERF_EVLIST__HLIST_SIZE];
24 25
};

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/**
 * __perf_evlist__for_each_entry - iterate thru all the evsels
 * @list: list_head instance to iterate
 * @evsel: struct perf_evsel iterator
 */
#define __perf_evlist__for_each_entry(list, evsel) \
	list_for_each_entry(evsel, list, node)

/**
 * evlist__for_each_entry - iterate thru all the evsels
 * @evlist: perf_evlist instance to iterate
 * @evsel: struct perf_evsel iterator
 */
#define perf_evlist__for_each_entry(evlist, evsel) \
	__perf_evlist__for_each_entry(&(evlist)->entries, evsel)

/**
 * __perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
 * @list: list_head instance to iterate
 * @evsel: struct evsel iterator
 */
#define __perf_evlist__for_each_entry_reverse(list, evsel) \
	list_for_each_entry_reverse(evsel, list, node)

/**
 * perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
 * @evlist: evlist instance to iterate
 * @evsel: struct evsel iterator
 */
#define perf_evlist__for_each_entry_reverse(evlist, evsel) \
	__perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel)

58
#endif /* __LIBPERF_INTERNAL_EVLIST_H */