aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/evsel.h')
-rw-r--r--tools/perf/util/evsel.h50
1 files changed, 21 insertions, 29 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 163c5604e5d1..38622747d130 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -36,6 +36,9 @@ struct perf_sample_id {
36 struct hlist_node node; 36 struct hlist_node node;
37 u64 id; 37 u64 id;
38 struct perf_evsel *evsel; 38 struct perf_evsel *evsel;
39 int idx;
40 int cpu;
41 pid_t tid;
39 42
40 /* Holds total ID period value for PERF_SAMPLE_READ processing. */ 43 /* Holds total ID period value for PERF_SAMPLE_READ processing. */
41 u64 period; 44 u64 period;
@@ -54,6 +57,7 @@ struct cgroup_sel;
54 * @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or 57 * @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or
55 * PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all 58 * PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all
56 * is used there is an id sample appended to non-sample events 59 * is used there is an id sample appended to non-sample events
60 * @priv: And what is in its containing unnamed union are tool specific
57 */ 61 */
58struct perf_evsel { 62struct perf_evsel {
59 struct list_head node; 63 struct list_head node;
@@ -69,10 +73,12 @@ struct perf_evsel {
69 char *name; 73 char *name;
70 double scale; 74 double scale;
71 const char *unit; 75 const char *unit;
76 bool snapshot;
72 struct event_format *tp_format; 77 struct event_format *tp_format;
73 union { 78 union {
74 void *priv; 79 void *priv;
75 off_t id_offset; 80 off_t id_offset;
81 u64 db_id;
76 }; 82 };
77 struct cgroup_sel *cgrp; 83 struct cgroup_sel *cgrp;
78 void *handler; 84 void *handler;
@@ -86,6 +92,8 @@ struct perf_evsel {
86 bool immediate; 92 bool immediate;
87 bool system_wide; 93 bool system_wide;
88 bool tracking; 94 bool tracking;
95 bool per_pkg;
96 unsigned long *per_pkg_mask;
89 /* parse modifier helper */ 97 /* parse modifier helper */
90 int exclude_GH; 98 int exclude_GH;
91 int nr_members; 99 int nr_members;
@@ -105,6 +113,12 @@ struct thread_map;
105struct perf_evlist; 113struct perf_evlist;
106struct record_opts; 114struct record_opts;
107 115
116void perf_counts_values__scale(struct perf_counts_values *count,
117 bool scale, s8 *pscaled);
118
119void perf_evsel__compute_deltas(struct perf_evsel *evsel, int cpu,
120 struct perf_counts_values *count);
121
108int perf_evsel__object_config(size_t object_size, 122int perf_evsel__object_config(size_t object_size,
109 int (*init)(struct perf_evsel *evsel), 123 int (*init)(struct perf_evsel *evsel),
110 void (*fini)(struct perf_evsel *evsel)); 124 void (*fini)(struct perf_evsel *evsel));
@@ -222,6 +236,13 @@ static inline bool perf_evsel__match2(struct perf_evsel *e1,
222 (a)->attr.type == (b)->attr.type && \ 236 (a)->attr.type == (b)->attr.type && \
223 (a)->attr.config == (b)->attr.config) 237 (a)->attr.config == (b)->attr.config)
224 238
239typedef int (perf_evsel__read_cb_t)(struct perf_evsel *evsel,
240 int cpu, int thread,
241 struct perf_counts_values *count);
242
243int perf_evsel__read_cb(struct perf_evsel *evsel, int cpu, int thread,
244 perf_evsel__read_cb_t cb);
245
225int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, 246int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
226 int cpu, int thread, bool scale); 247 int cpu, int thread, bool scale);
227 248
@@ -251,35 +272,6 @@ static inline int perf_evsel__read_on_cpu_scaled(struct perf_evsel *evsel,
251 return __perf_evsel__read_on_cpu(evsel, cpu, thread, true); 272 return __perf_evsel__read_on_cpu(evsel, cpu, thread, true);
252} 273}
253 274
254int __perf_evsel__read(struct perf_evsel *evsel, int ncpus, int nthreads,
255 bool scale);
256
257/**
258 * perf_evsel__read - Read the aggregate results on all CPUs
259 *
260 * @evsel - event selector to read value
261 * @ncpus - Number of cpus affected, from zero
262 * @nthreads - Number of threads affected, from zero
263 */
264static inline int perf_evsel__read(struct perf_evsel *evsel,
265 int ncpus, int nthreads)
266{
267 return __perf_evsel__read(evsel, ncpus, nthreads, false);
268}
269
270/**
271 * perf_evsel__read_scaled - Read the aggregate results on all CPUs, scaled
272 *
273 * @evsel - event selector to read value
274 * @ncpus - Number of cpus affected, from zero
275 * @nthreads - Number of threads affected, from zero
276 */
277static inline int perf_evsel__read_scaled(struct perf_evsel *evsel,
278 int ncpus, int nthreads)
279{
280 return __perf_evsel__read(evsel, ncpus, nthreads, true);
281}
282
283int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, 275int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
284 struct perf_sample *sample); 276 struct perf_sample *sample);
285 277