diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index 646bdd5187939b86ee06bdcad5291ff92f5730e5..fdc8c1894b37da573fef71b19c4b4649bade88af 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -2,3 +2,8 @@ #include <perf/evlist.h> #include <linux/list.h> #include <internal/evlist.h> + +void perf_evlist__init(struct perf_evlist *evlist) +{ + INIT_LIST_HEAD(&evlist->entries); +} diff --git a/tools/perf/lib/include/perf/evlist.h b/tools/perf/lib/include/perf/evlist.h index 92b0eb39caec382f45c9f896967cc52dc4cbf7eb..1ddfcca0bd01526132158b6093b7b0c4c863c72d 100644 --- a/tools/perf/lib/include/perf/evlist.h +++ b/tools/perf/lib/include/perf/evlist.h @@ -2,6 +2,10 @@ #ifndef __LIBPERF_EVLIST_H #define __LIBPERF_EVLIST_H +#include <perf/core.h> + struct perf_evlist; +LIBPERF_API void perf_evlist__init(struct perf_evlist *evlist); + #endif /* __LIBPERF_EVLIST_H */ diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index 54f8503c6d82f9aa21d56d82d3baf5ce45e9fcd9..5ca6ff6fcdfa1a0bc3432d4ff86679ad0fc3466e 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map @@ -10,6 +10,7 @@ LIBPERF_0.0.1 { perf_thread_map__get; perf_thread_map__put; perf_evsel__init; + perf_evlist__init; local: *; }; diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index faf3ffd81d4cd007dc8165766bb434884c41a15a..f4aa6cf805595c25ffd33fe3da6c7f9a5b36b2d1 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -33,6 +33,7 @@ #include <linux/log2.h> #include <linux/err.h> #include <linux/zalloc.h> +#include <perf/evlist.h> #ifdef LACKS_SIGQUEUE_PROTOTYPE int sigqueue(pid_t pid, int sig, const union sigval value); @@ -48,7 +49,7 @@ void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus, for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i) INIT_HLIST_HEAD(&evlist->heads[i]); - INIT_LIST_HEAD(&evlist->core.entries); + perf_evlist__init(&evlist->core); perf_evlist__set_maps(evlist, cpus, threads); fdarray__init(&evlist->pollfd, 64); evlist->workload.pid = -1;