diff options
Diffstat (limited to 'tools/perf/util/evsel.h')
-rw-r--r-- | tools/perf/util/evsel.h | 63 |
1 files changed, 53 insertions, 10 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index b559929983bb..3ead0d59c03d 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -53,9 +53,10 @@ struct perf_evsel { | |||
53 | u64 *id; | 53 | u64 *id; |
54 | struct perf_counts *counts; | 54 | struct perf_counts *counts; |
55 | int idx; | 55 | int idx; |
56 | int ids; | 56 | u32 ids; |
57 | struct hists hists; | 57 | struct hists hists; |
58 | char *name; | 58 | char *name; |
59 | struct event_format *tp_format; | ||
59 | union { | 60 | union { |
60 | void *priv; | 61 | void *priv; |
61 | off_t id_offset; | 62 | off_t id_offset; |
@@ -65,8 +66,14 @@ struct perf_evsel { | |||
65 | void *func; | 66 | void *func; |
66 | void *data; | 67 | void *data; |
67 | } handler; | 68 | } handler; |
69 | struct cpu_map *cpus; | ||
68 | unsigned int sample_size; | 70 | unsigned int sample_size; |
69 | bool supported; | 71 | bool supported; |
72 | bool needs_swap; | ||
73 | /* parse modifier helper */ | ||
74 | int exclude_GH; | ||
75 | struct perf_evsel *leader; | ||
76 | char *group_name; | ||
70 | }; | 77 | }; |
71 | 78 | ||
72 | struct cpu_map; | 79 | struct cpu_map; |
@@ -75,6 +82,10 @@ struct perf_evlist; | |||
75 | struct perf_record_opts; | 82 | struct perf_record_opts; |
76 | 83 | ||
77 | struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx); | 84 | struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx); |
85 | struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx); | ||
86 | |||
87 | struct event_format *event_format__new(const char *sys, const char *name); | ||
88 | |||
78 | void perf_evsel__init(struct perf_evsel *evsel, | 89 | void perf_evsel__init(struct perf_evsel *evsel, |
79 | struct perf_event_attr *attr, int idx); | 90 | struct perf_event_attr *attr, int idx); |
80 | void perf_evsel__exit(struct perf_evsel *evsel); | 91 | void perf_evsel__exit(struct perf_evsel *evsel); |
@@ -92,8 +103,10 @@ extern const char *perf_evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX] | |||
92 | [PERF_EVSEL__MAX_ALIASES]; | 103 | [PERF_EVSEL__MAX_ALIASES]; |
93 | extern const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX] | 104 | extern const char *perf_evsel__hw_cache_op[PERF_COUNT_HW_CACHE_OP_MAX] |
94 | [PERF_EVSEL__MAX_ALIASES]; | 105 | [PERF_EVSEL__MAX_ALIASES]; |
95 | const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX] | 106 | extern const char *perf_evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX] |
96 | [PERF_EVSEL__MAX_ALIASES]; | 107 | [PERF_EVSEL__MAX_ALIASES]; |
108 | extern const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX]; | ||
109 | extern const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX]; | ||
97 | int __perf_evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, | 110 | int __perf_evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, |
98 | char *bf, size_t size); | 111 | char *bf, size_t size); |
99 | const char *perf_evsel__name(struct perf_evsel *evsel); | 112 | const char *perf_evsel__name(struct perf_evsel *evsel); |
@@ -105,21 +118,46 @@ void perf_evsel__free_fd(struct perf_evsel *evsel); | |||
105 | void perf_evsel__free_id(struct perf_evsel *evsel); | 118 | void perf_evsel__free_id(struct perf_evsel *evsel); |
106 | void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); | 119 | void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); |
107 | 120 | ||
121 | int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, | ||
122 | const char *filter); | ||
123 | |||
108 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, | 124 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, |
109 | struct cpu_map *cpus, bool group, | 125 | struct cpu_map *cpus); |
110 | struct xyarray *group_fds); | ||
111 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, | 126 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, |
112 | struct thread_map *threads, bool group, | 127 | struct thread_map *threads); |
113 | struct xyarray *group_fds); | ||
114 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 128 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, |
115 | struct thread_map *threads, bool group, | 129 | struct thread_map *threads); |
116 | struct xyarray *group_fds); | ||
117 | void perf_evsel__close(struct perf_evsel *evsel, int ncpus, int nthreads); | 130 | void perf_evsel__close(struct perf_evsel *evsel, int ncpus, int nthreads); |
118 | 131 | ||
132 | struct perf_sample; | ||
133 | |||
134 | void *perf_evsel__rawptr(struct perf_evsel *evsel, struct perf_sample *sample, | ||
135 | const char *name); | ||
136 | u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample, | ||
137 | const char *name); | ||
138 | |||
139 | static inline char *perf_evsel__strval(struct perf_evsel *evsel, | ||
140 | struct perf_sample *sample, | ||
141 | const char *name) | ||
142 | { | ||
143 | return perf_evsel__rawptr(evsel, sample, name); | ||
144 | } | ||
145 | |||
146 | struct format_field; | ||
147 | |||
148 | struct format_field *perf_evsel__field(struct perf_evsel *evsel, const char *name); | ||
149 | |||
119 | #define perf_evsel__match(evsel, t, c) \ | 150 | #define perf_evsel__match(evsel, t, c) \ |
120 | (evsel->attr.type == PERF_TYPE_##t && \ | 151 | (evsel->attr.type == PERF_TYPE_##t && \ |
121 | evsel->attr.config == PERF_COUNT_##c) | 152 | evsel->attr.config == PERF_COUNT_##c) |
122 | 153 | ||
154 | static inline bool perf_evsel__match2(struct perf_evsel *e1, | ||
155 | struct perf_evsel *e2) | ||
156 | { | ||
157 | return (e1->attr.type == e2->attr.type) && | ||
158 | (e1->attr.config == e2->attr.config); | ||
159 | } | ||
160 | |||
123 | int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, | 161 | int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, |
124 | int cpu, int thread, bool scale); | 162 | int cpu, int thread, bool scale); |
125 | 163 | ||
@@ -181,5 +219,10 @@ static inline int perf_evsel__read_scaled(struct perf_evsel *evsel, | |||
181 | void hists__init(struct hists *hists); | 219 | void hists__init(struct hists *hists); |
182 | 220 | ||
183 | int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, | 221 | int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, |
184 | struct perf_sample *sample, bool swapped); | 222 | struct perf_sample *sample); |
223 | |||
224 | static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) | ||
225 | { | ||
226 | return list_entry(evsel->node.next, struct perf_evsel, node); | ||
227 | } | ||
185 | #endif /* __PERF_EVSEL_H */ | 228 | #endif /* __PERF_EVSEL_H */ |