summaryrefslogtreecommitdiffstats
path: root/tools/perf/lib/include
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-09-03 10:34:29 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 09:51:48 -0300
commit70c20369ee95ef8b6887944194cfb74a5a8d1fe3 (patch)
treee25bde2c86f36e6375d234e97e62050daca95b0a /tools/perf/lib/include
parent1d5af02d7a92acaa877ab0fbec0756114852720a (diff)
downloadlinux-70c20369ee95ef8b6887944194cfb74a5a8d1fe3.tar.gz
linux-70c20369ee95ef8b6887944194cfb74a5a8d1fe3.tar.bz2
linux-70c20369ee95ef8b6887944194cfb74a5a8d1fe3.zip
libperf: Add perf_evsel__alloc_id/perf_evsel__free_id functions
Add perf_evsel__alloc_id()/perf_evsel__free_id() functions to libperf as internal functions. Move 'struct perf_sample_id' to internal/evsel.h header and change 'struct perf_sample_id::evsel' to 'struct perf_evsel' and the related code that touches it. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lore.kernel.org/lkml/20190913132355.21634-28-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib/include')
-rw-r--r--tools/perf/lib/include/internal/evsel.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h
index 385766f06591..a69b8299c36f 100644
--- a/tools/perf/lib/include/internal/evsel.h
+++ b/tools/perf/lib/include/internal/evsel.h
@@ -5,11 +5,35 @@
#include <linux/types.h>
#include <linux/perf_event.h>
#include <stdbool.h>
+#include <sys/types.h>
struct perf_cpu_map;
struct perf_thread_map;
struct xyarray;
+/*
+ * Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are
+ * more than one entry in the evlist.
+ */
+struct perf_sample_id {
+ struct hlist_node node;
+ u64 id;
+ struct perf_evsel *evsel;
+ /*
+ * 'idx' will be used for AUX area sampling. A sample will have AUX area
+ * data that will be queued for decoding, where there are separate
+ * queues for each CPU (per-cpu tracing) or task (per-thread tracing).
+ * The sample ID can be used to lookup 'idx' which is effectively the
+ * queue number.
+ */
+ int idx;
+ int cpu;
+ pid_t tid;
+
+ /* Holds total ID period value for PERF_SAMPLE_READ processing. */
+ u64 period;
+};
+
struct perf_evsel {
struct list_head node;
struct perf_event_attr attr;
@@ -32,4 +56,7 @@ void perf_evsel__free_fd(struct perf_evsel *evsel);
int perf_evsel__read_size(struct perf_evsel *evsel);
int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter);
+int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
+void perf_evsel__free_id(struct perf_evsel *evsel);
+
#endif /* __LIBPERF_INTERNAL_EVSEL_H */