Commit 80ab2987 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

libperf: Add perf_evlist__poll() function



Move perf_evlist__poll() from tools/perf to libperf, it will be used in
the following patches.

And rename the existing perf's function to evlist__poll().

Signed-off-by: default avatarJiri 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-39-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f4009e7b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1615,7 +1615,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
		if (hits == rec->samples) {
			if (done || draining)
				break;
			err = perf_evlist__poll(rec->evlist, -1);
			err = evlist__poll(rec->evlist, -1);
			/*
			 * Propagate error, only if there's any. Ignore positive
			 * number of returned events and interrupt error.
+2 −2
Original line number Diff line number Diff line
@@ -1307,7 +1307,7 @@ static int __cmd_top(struct perf_top *top)
	}

	/* Wait for a minimal set of events before starting the snapshot */
	perf_evlist__poll(top->evlist, 100);
	evlist__poll(top->evlist, 100);

	perf_top__mmap_read(top);

@@ -1317,7 +1317,7 @@ static int __cmd_top(struct perf_top *top)
		perf_top__mmap_read(top);

		if (opts->overwrite || (hits == top->samples))
			ret = perf_evlist__poll(top->evlist, 100);
			ret = evlist__poll(top->evlist, 100);

		if (resize) {
			perf_top__resize(top);
+1 −1
Original line number Diff line number Diff line
@@ -3474,7 +3474,7 @@ again:
	if (trace->nr_events == before) {
		int timeout = done ? 100 : -1;

		if (!draining && perf_evlist__poll(evlist, timeout) > 0) {
		if (!draining && evlist__poll(evlist, timeout) > 0) {
			if (evlist__filter_pollfd(evlist, POLLERR | POLLHUP | POLLNVAL) == 0)
				draining = true;

+5 −0
Original line number Diff line number Diff line
@@ -276,3 +276,8 @@ int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd,

	return pos;
}

int perf_evlist__poll(struct perf_evlist *evlist, int timeout)
{
	return fdarray__poll(&evlist->pollfd, timeout);
}
+1 −0
Original line number Diff line number Diff line
@@ -31,5 +31,6 @@ LIBPERF_API void perf_evlist__disable(struct perf_evlist *evlist);
LIBPERF_API void perf_evlist__set_maps(struct perf_evlist *evlist,
				       struct perf_cpu_map *cpus,
				       struct perf_thread_map *threads);
LIBPERF_API int perf_evlist__poll(struct perf_evlist *evlist, int timeout);

#endif /* __LIBPERF_EVLIST_H */
Loading