lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Aug 2014 10:50:13 +0200
From:	Jiri Olsa <jolsa@...nel.org>
To:	linux-kernel@...r.kernel.org
Cc:	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Jean Pihet <jean.pihet@...aro.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH 19/20] perf tests: Use poller object for polling

Several tests are using evlist->pollfd means for
polling events. Changing them to use poller object.

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jean Pihet <jean.pihet@...aro.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
 tools/perf/tests/open-syscall-tp-fields.c | 9 ++++++++-
 tools/perf/tests/perf-record.c            | 4 ----
 tools/perf/tests/task-exit.c              | 9 ++++++++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c
index 0785b64ffd6c..b0fc35d23244 100644
--- a/tools/perf/tests/open-syscall-tp-fields.c
+++ b/tools/perf/tests/open-syscall-tp-fields.c
@@ -4,6 +4,7 @@
 #include "thread_map.h"
 #include "tests.h"
 #include "debug.h"
+#include "poller.h"
 
 int test__syscall_open_tp_fields(void)
 {
@@ -58,6 +59,12 @@ int test__syscall_open_tp_fields(void)
 		goto out_delete_evlist;
 	}
 
+	err = perf_evlist__set_poller(evlist);
+	if (err < 0) {
+		pr_debug("perf_evlist__set_poller: %s\n", strerror(errno));
+		goto out_delete_evlist;
+	};
+
 	perf_evlist__enable(evlist);
 
 	/*
@@ -102,7 +109,7 @@ int test__syscall_open_tp_fields(void)
 		}
 
 		if (nr_events == before)
-			poll(evlist->pollfd, evlist->nr_fds, 10);
+			poller__poll(&evlist->poller, 10);
 
 		if (++nr_polls > 5) {
 			pr_debug("%s: no events!\n", __func__);
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index aca1a83dd13a..ee5d2881e3fe 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -147,8 +147,6 @@ int test__PERF_RECORD(void)
 	perf_evlist__start_workload(evlist);
 
 	while (1) {
-		int before = total_events;
-
 		for (i = 0; i < evlist->nr_mmaps; i++) {
 			union perf_event *event;
 
@@ -262,8 +260,6 @@ int test__PERF_RECORD(void)
 		 * PERF_RECORD_{!SAMPLE} events don't honour
 		 * perf_event_attr.wakeup_events, just PERF_EVENT_SAMPLE does.
 		 */
-		if (total_events == before && false)
-			poll(evlist->pollfd, evlist->nr_fds, -1);
 
 		sleep(1);
 		if (++wakeups > 5) {
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 5ff3db318f12..bc858c799ff2 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -3,6 +3,7 @@
 #include "thread_map.h"
 #include "cpumap.h"
 #include "tests.h"
+#include "poller.h"
 
 #include <signal.h>
 
@@ -92,6 +93,12 @@ int test__task_exit(void)
 		goto out_delete_evlist;
 	}
 
+	if (perf_evlist__set_poller(evlist)) {
+		pr_debug("failed to set poller: %d (%s)\n", errno,
+			 strerror(errno));
+		goto out_delete_evlist;
+	}
+
 	perf_evlist__start_workload(evlist);
 
 retry:
@@ -103,7 +110,7 @@ retry:
 	}
 
 	if (!exited || !nr_exit) {
-		poll(evlist->pollfd, evlist->nr_fds, -1);
+		poller__poll(&evlist->poller, -1);
 		goto retry;
 	}
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists