Skip to contentSkip to conversation

perf tests: Add test for perf_evlist__filter_pollfd()

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Sep 26, 2014 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  54dbfae3007b0c61727abba45af1e4c226908d82
Gitweb:     http://git.kernel.org/tip/54dbfae3007b0c61727abba45af1e4c226908d82
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 12 Aug 2014 23:34:06 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 25 Sep 2014 16:46:53 -0300

perf tests: Add test for perf_evlist__filter_pollfd()

That will use a synthetic evlist with just what is touched by this new method to check that it works as expected.

Output in verbose mode:

  $ perf test -v pollfd
  33: Filter fds with revents mask in a pollfd array         :
  --- start ---
  filtering all but pollfd[2]:
  before:   5 [ 5, 4, 3, 2, 1 ]
   after:   1 [ 3 ]
  filtering all but (pollfd[0], pollfd[3]):
  before:   5 [ 5, 4, 3, 2, 1 ]
   after:   2 [ 5, 2 ]
  test child finished with 0
  ---- end ----
  Filter fds with revents mask in a pollfd array: Ok
  $
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Don Zickus <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile.perf        |   1 +
 tools/perf/tests/builtin-test.c |   4 ++
 tools/perf/tests/evlist.c       | 103 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 109 insertions(+)
tools/perf/Makefile.perf +1 -0
index 171f4e6..f287c25 100644
@@ -400,6 +400,7 @@ LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
+LIB_OBJS += $(OUTPUT)tests/evlist.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
 LIB_OBJS += $(OUTPUT)tests/pmu.o
tools/perf/tests/builtin-test.c +4 -0
index 6a4145e..41e556e 100644
@@ -158,6 +158,10 @@ static struct test {
 		.func = test__switch_tracking,
 	},
 	{
+		.desc = "Filter fds with revents mask in a pollfd array",
+		.func = test__perf_evlist__filter_pollfd,
+	},
+	{
 		.func = NULL,
 	},
 };
tools/perf/tests/evlist.c new file +103 -0

103 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index be8be10..72c4c03 100644
@@ -49,6 +49,7 @@ int test__thread_mg_share(void);
 int test__hists_output(void);
 int test__hists_cumulate(void);
 int test__switch_tracking(void);
+int test__perf_evlist__filter_pollfd(void);
 
 #if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT