~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/lib/perf/include/internal/evlist.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __LIBPERF_INTERNAL_EVLIST_H
  3 #define __LIBPERF_INTERNAL_EVLIST_H
  4 
  5 #include <linux/list.h>
  6 #include <api/fd/array.h>
  7 #include <internal/cpumap.h>
  8 #include <internal/evsel.h>
  9 
 10 #define PERF_EVLIST__HLIST_BITS 8
 11 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
 12 
 13 struct perf_cpu_map;
 14 struct perf_thread_map;
 15 struct perf_mmap_param;
 16 
 17 struct perf_evlist {
 18         struct list_head         entries;
 19         int                      nr_entries;
 20         bool                     has_user_cpus;
 21         bool                     needs_map_propagation;
 22         /**
 23          * The cpus passed from the command line or all online CPUs by
 24          * default.
 25          */
 26         struct perf_cpu_map     *user_requested_cpus;
 27         /** The union of all evsel cpu maps. */
 28         struct perf_cpu_map     *all_cpus;
 29         struct perf_thread_map  *threads;
 30         int                      nr_mmaps;
 31         size_t                   mmap_len;
 32         struct fdarray           pollfd;
 33         struct hlist_head        heads[PERF_EVLIST__HLIST_SIZE];
 34         struct perf_mmap        *mmap;
 35         struct perf_mmap        *mmap_ovw;
 36         struct perf_mmap        *mmap_first;
 37         struct perf_mmap        *mmap_ovw_first;
 38 };
 39 
 40 typedef void
 41 (*perf_evlist_mmap__cb_idx_t)(struct perf_evlist*, struct perf_evsel*,
 42                               struct perf_mmap_param*, int);
 43 typedef struct perf_mmap*
 44 (*perf_evlist_mmap__cb_get_t)(struct perf_evlist*, bool, int);
 45 typedef int
 46 (*perf_evlist_mmap__cb_mmap_t)(struct perf_mmap*, struct perf_mmap_param*, int, struct perf_cpu);
 47 
 48 struct perf_evlist_mmap_ops {
 49         perf_evlist_mmap__cb_idx_t      idx;
 50         perf_evlist_mmap__cb_get_t      get;
 51         perf_evlist_mmap__cb_mmap_t     mmap;
 52 };
 53 
 54 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
 55 int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd,
 56                             void *ptr, short revent, enum fdarray_flags flags);
 57 
 58 int perf_evlist__mmap_ops(struct perf_evlist *evlist,
 59                           struct perf_evlist_mmap_ops *ops,
 60                           struct perf_mmap_param *mp);
 61 
 62 void perf_evlist__init(struct perf_evlist *evlist);
 63 void perf_evlist__exit(struct perf_evlist *evlist);
 64 
 65 /**
 66  * __perf_evlist__for_each_entry - iterate thru all the evsels
 67  * @list: list_head instance to iterate
 68  * @evsel: struct perf_evsel iterator
 69  */
 70 #define __perf_evlist__for_each_entry(list, evsel) \
 71         list_for_each_entry(evsel, list, node)
 72 
 73 /**
 74  * evlist__for_each_entry - iterate thru all the evsels
 75  * @evlist: perf_evlist instance to iterate
 76  * @evsel: struct perf_evsel iterator
 77  */
 78 #define perf_evlist__for_each_entry(evlist, evsel) \
 79         __perf_evlist__for_each_entry(&(evlist)->entries, evsel)
 80 
 81 /**
 82  * __perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
 83  * @list: list_head instance to iterate
 84  * @evsel: struct evsel iterator
 85  */
 86 #define __perf_evlist__for_each_entry_reverse(list, evsel) \
 87         list_for_each_entry_reverse(evsel, list, node)
 88 
 89 /**
 90  * perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
 91  * @evlist: evlist instance to iterate
 92  * @evsel: struct evsel iterator
 93  */
 94 #define perf_evlist__for_each_entry_reverse(evlist, evsel) \
 95         __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel)
 96 
 97 /**
 98  * __perf_evlist__for_each_entry_safe - safely iterate thru all the evsels
 99  * @list: list_head instance to iterate
100  * @tmp: struct evsel temp iterator
101  * @evsel: struct evsel iterator
102  */
103 #define __perf_evlist__for_each_entry_safe(list, tmp, evsel) \
104         list_for_each_entry_safe(evsel, tmp, list, node)
105 
106 /**
107  * perf_evlist__for_each_entry_safe - safely iterate thru all the evsels
108  * @evlist: evlist instance to iterate
109  * @evsel: struct evsel iterator
110  * @tmp: struct evsel temp iterator
111  */
112 #define perf_evlist__for_each_entry_safe(evlist, tmp, evsel) \
113         __perf_evlist__for_each_entry_safe(&(evlist)->entries, tmp, evsel)
114 
115 static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist)
116 {
117         return list_entry(evlist->entries.next, struct perf_evsel, node);
118 }
119 
120 static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist)
121 {
122         return list_entry(evlist->entries.prev, struct perf_evsel, node);
123 }
124 
125 u64 perf_evlist__read_format(struct perf_evlist *evlist);
126 
127 void perf_evlist__id_add(struct perf_evlist *evlist,
128                          struct perf_evsel *evsel,
129                          int cpu_map_idx, int thread, u64 id);
130 
131 int perf_evlist__id_add_fd(struct perf_evlist *evlist,
132                            struct perf_evsel *evsel,
133                            int cpu_map_idx, int thread, int fd);
134 
135 void perf_evlist__reset_id_hash(struct perf_evlist *evlist);
136 
137 void __perf_evlist__set_leader(struct list_head *list, struct perf_evsel *leader);
138 
139 void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel);
140 #endif /* __LIBPERF_INTERNAL_EVLIST_H */
141 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php