summaryrefslogtreecommitdiff
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.h59
1 files changed, 32 insertions, 27 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 163fc2b6a7ea..d9ecc6628217 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -2,28 +2,31 @@
#ifndef __PERF_EVSEL_H
#define __PERF_EVSEL_H 1
-#include <linux/list.h>
#include <stdbool.h>
-#include <sys/types.h>
+
+#include <linux/list.h>
#include <linux/perf_event.h>
+#include <linux/refcount.h>
#include <linux/types.h>
+#include <sys/types.h>
+
#include <internal/evsel.h>
#include <perf/evsel.h>
+
#include "symbol_conf.h"
-#include "pmus.h"
-#include "pmu.h"
+struct bperf_follower_bpf;
+struct bperf_leader_bpf;
+struct bpf_counter_ops;
struct bpf_object;
struct cgroup;
+struct hashmap;
struct perf_counts;
+struct perf_pmu;
struct perf_stat_config;
struct perf_stat_evsel;
-union perf_event;
-struct bpf_counter_ops;
struct target;
-struct hashmap;
-struct bperf_leader_bpf;
-struct bperf_follower_bpf;
+union perf_event;
typedef int (evsel__sb_cb_t)(union perf_event *event, void *data);
@@ -45,6 +48,7 @@ typedef int (evsel__sb_cb_t)(union perf_event *event, void *data);
struct evsel {
struct perf_evsel core;
struct evlist *evlist;
+ refcount_t refcnt;
off_t id_offset;
int id_pos;
int is_pos;
@@ -70,6 +74,10 @@ struct evsel {
const char *unit;
struct cgroup *cgrp;
const char *metric_id;
+
+ /* The PMU the event is from. Used for missing_features, PMU name, etc. */
+ struct perf_pmu *pmu;
+
/*
* This point to the first evsel with the same name, intended to store the
* aggregated counts in aggregation mode.
@@ -90,8 +98,8 @@ struct evsel {
bool skippable;
bool retire_lat;
bool dont_regroup;
- int bpf_fd;
- struct bpf_object *bpf_obj;
+ bool default_metricgroup; /* A member of the Default metricgroup */
+ bool default_show_events; /* If a default group member, show the event */
struct list_head config_terms;
u64 alternate_hw_config;
};
@@ -121,8 +129,6 @@ struct evsel {
bool cmdline_group_boundary;
bool reset_group;
bool needs_auxtrace_mmap;
- bool default_metricgroup; /* A member of the Default metricgroup */
- bool default_show_events; /* If a default group member, show the event */
bool needs_uniquify;
bool fallenback_eacces;
bool fallenback_eopnotsupp;
@@ -178,9 +184,6 @@ struct evsel {
unsigned long open_flags;
int precise_ip_original;
- /* The PMU the event is from. Used for missing_features, PMU name, etc. */
- struct perf_pmu *pmu;
-
/* For tool events */
/* Beginning time subtracted when the counter is read. */
union {
@@ -271,7 +274,7 @@ static inline struct evsel *evsel__new(struct perf_event_attr *attr)
return evsel__new_idx(attr, 0);
}
-struct evsel *evsel__clone(struct evsel *dest, struct evsel *orig);
+struct evsel *evsel__clone(struct evsel *orig);
int copy_config_terms(struct list_head *dst, struct list_head *src);
void free_config_terms(struct list_head *config_terms);
@@ -286,14 +289,13 @@ static inline struct evsel *evsel__newtp(const char *sys, const char *name)
return evsel__newtp_idx(sys, name, 0, true);
}
+struct evsel *evsel__get(struct evsel *evsel);
+void evsel__put(struct evsel *evsel);
+
#ifdef HAVE_LIBTRACEEVENT
struct tep_event *evsel__tp_format(struct evsel *evsel);
#endif
-void evsel__init(struct evsel *evsel, struct perf_event_attr *attr, int idx);
-void evsel__exit(struct evsel *evsel);
-void evsel__delete(struct evsel *evsel);
-
void evsel__set_priv_destructor(void (*destructor)(void *priv));
struct callchain_param;
@@ -361,10 +363,6 @@ void arch_evsel__apply_ratio_to_prev(struct evsel *evsel, struct perf_event_attr
int evsel__set_filter(struct evsel *evsel, const char *filter);
int evsel__append_tp_filter(struct evsel *evsel, const char *filter);
int evsel__append_addr_filter(struct evsel *evsel, const char *filter);
-static inline bool evsel__is_non_perf_event_open_pmu(const struct evsel *evsel)
-{
- return evsel->pmu && evsel->pmu->type > PERF_PMU_TYPE_PE_END;
-}
int evsel__enable_cpu(struct evsel *evsel, int cpu_map_idx);
int evsel__enable(struct evsel *evsel);
@@ -400,6 +398,12 @@ static inline char *perf_sample__strval(struct perf_sample *sample, const char *
struct tep_format_field;
+void *format_field__get_raw_data(struct tep_format_field *field,
+ struct perf_sample *sample,
+ bool needs_swap, u16 *len_out);
+unsigned long *format_field__get_cpumask(struct tep_format_field *field,
+ struct perf_sample *sample,
+ bool needs_swap, u16 *len_out);
u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sample, bool needs_swap);
#ifdef HAVE_LIBTRACEEVENT
@@ -503,6 +507,7 @@ static inline bool evsel__is_group_event(struct evsel *evsel)
return evsel__is_group_leader(evsel) && evsel->core.nr_members > 1;
}
+bool evsel__is_non_perf_event_open_pmu(const struct evsel *evsel);
bool evsel__is_function_event(struct evsel *evsel);
static inline bool evsel__is_bpf_output(struct evsel *evsel)
@@ -534,7 +539,7 @@ for ((_evsel) = list_entry((_leader)->core.node.next, struct evsel, core.node);
(_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node))
#define for_each_group_member(_evsel, _leader) \
- for_each_group_member_head(_evsel, _leader, &(_leader)->evlist->core.entries)
+ for_each_group_member_head(_evsel, _leader, &evlist__core((_leader)->evlist)->entries)
/* Iterates group WITH the leader. */
#define for_each_group_evsel_head(_evsel, _leader, _head) \
@@ -544,7 +549,7 @@ for ((_evsel) = _leader; \
(_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node))
#define for_each_group_evsel(_evsel, _leader) \
- for_each_group_evsel_head(_evsel, _leader, &(_leader)->evlist->core.entries)
+ for_each_group_evsel_head(_evsel, _leader, &evlist__core((_leader)->evlist)->entries)
static inline bool evsel__has_branch_callstack(const struct evsel *evsel)
{