diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-18 17:25:59 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-25 16:46:55 -0300 |
commit | f66a889dbc96dd342c87232d74f0956076707746 (patch) | |
tree | e56930da92ec4753c15c2d572d4c87db935d2d41 /tools/perf/util | |
parent | 0a04c9e0b2181aff8348b5e80d9d96ec8df1ffb3 (diff) | |
download | linux-f66a889dbc96dd342c87232d74f0956076707746.tar.bz2 |
perf evlist: Introduce poll method for common code idiom
Since we have access two evlist members in all these poll calls, provide
a helper.
This will also help to make the patch introducing the pollfd class more
clear, as the evlist specific uses will be hiden away
perf_evlist__poll().
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-jr9d4aop4lvy9453qahbcgp0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/evlist.c | 5 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 | ||||
-rw-r--r-- | tools/perf/util/python.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index bcf157c8a9da..5ff3c667542f 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -475,6 +475,11 @@ int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mas return nr_fds; } +int perf_evlist__poll(struct perf_evlist *evlist, int timeout) +{ + return poll(evlist->pollfd, evlist->nr_fds, timeout); +} + static void perf_evlist__id_hash(struct perf_evlist *evlist, struct perf_evsel *evsel, int cpu, int thread, u64 id) diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index bbc2fd01b5c5..d7e99b67c94f 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -87,6 +87,8 @@ int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd); int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mask); +int perf_evlist__poll(struct perf_evlist *evlist, int timeout); + struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 12aa9b0d0ba1..4472f8be8e35 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -736,7 +736,7 @@ static PyObject *pyrf_evlist__poll(struct pyrf_evlist *pevlist, if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", kwlist, &timeout)) return NULL; - n = poll(evlist->pollfd, evlist->nr_fds, timeout); + n = perf_evlist__poll(evlist, timeout); if (n < 0) { PyErr_SetFromErrno(PyExc_OSError); return NULL; |