root/tools/perf/lib/include/internal/evlist.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. perf_evlist__first
  2. perf_evlist__last

   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/evsel.h>
   8 
   9 #define PERF_EVLIST__HLIST_BITS 8
  10 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
  11 
  12 struct perf_cpu_map;
  13 struct perf_thread_map;
  14 
  15 struct perf_evlist {
  16         struct list_head         entries;
  17         int                      nr_entries;
  18         bool                     has_user_cpus;
  19         struct perf_cpu_map     *cpus;
  20         struct perf_thread_map  *threads;
  21         int                      nr_mmaps;
  22         size_t                   mmap_len;
  23         struct fdarray           pollfd;
  24         struct hlist_head        heads[PERF_EVLIST__HLIST_SIZE];
  25 };
  26 
  27 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
  28 int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd,
  29                             void *ptr, short revent);
  30 
  31 /**
  32  * __perf_evlist__for_each_entry - iterate thru all the evsels
  33  * @list: list_head instance to iterate
  34  * @evsel: struct perf_evsel iterator
  35  */
  36 #define __perf_evlist__for_each_entry(list, evsel) \
  37         list_for_each_entry(evsel, list, node)
  38 
  39 /**
  40  * evlist__for_each_entry - iterate thru all the evsels
  41  * @evlist: perf_evlist instance to iterate
  42  * @evsel: struct perf_evsel iterator
  43  */
  44 #define perf_evlist__for_each_entry(evlist, evsel) \
  45         __perf_evlist__for_each_entry(&(evlist)->entries, evsel)
  46 
  47 /**
  48  * __perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
  49  * @list: list_head instance to iterate
  50  * @evsel: struct evsel iterator
  51  */
  52 #define __perf_evlist__for_each_entry_reverse(list, evsel) \
  53         list_for_each_entry_reverse(evsel, list, node)
  54 
  55 /**
  56  * perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
  57  * @evlist: evlist instance to iterate
  58  * @evsel: struct evsel iterator
  59  */
  60 #define perf_evlist__for_each_entry_reverse(evlist, evsel) \
  61         __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel)
  62 
  63 static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist)
  64 {
  65         return list_entry(evlist->entries.next, struct perf_evsel, node);
  66 }
  67 
  68 static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist)
  69 {
  70         return list_entry(evlist->entries.prev, struct perf_evsel, node);
  71 }
  72 
  73 u64 perf_evlist__read_format(struct perf_evlist *evlist);
  74 
  75 void perf_evlist__id_add(struct perf_evlist *evlist,
  76                          struct perf_evsel *evsel,
  77                          int cpu, int thread, u64 id);
  78 
  79 int perf_evlist__id_add_fd(struct perf_evlist *evlist,
  80                            struct perf_evsel *evsel,
  81                            int cpu, int thread, int fd);
  82 
  83 #endif /* __LIBPERF_INTERNAL_EVLIST_H */

/* [<][>][^][v][top][bottom][index][help] */