diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2013-08-06 09:28:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-07 16:35:40 -0400 |
commit | c9ee780f2736b7a149658b0cd8c8389da23e190a (patch) | |
tree | 2f56fed358edb74e49cc6fc0c0a974deac688597 /tools/perf/tests/parse-events.c | |
parent | e9a7c414477d20c3cc56f90f29c35b06f0f15e25 (diff) |
perf tests: Add tests of new pinned modifier
Add a negative test to test__checkevent_pmu_events() to get lots of
coverage of the negative case, ie. when the modifier is not specified.
Add a test of a single event, and of the group case.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1375795686-4226-2-git-send-email-michael@ellerman.id.au
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/parse-events.c')
-rw-r--r-- | tools/perf/tests/parse-events.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index b46379c82872..48114d164e9f 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -452,6 +452,7 @@ static int test__checkevent_pmu_events(struct perf_evlist *evlist) | |||
452 | evsel->attr.exclude_kernel); | 452 | evsel->attr.exclude_kernel); |
453 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 453 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
454 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 454 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
455 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); | ||
455 | 456 | ||
456 | return 0; | 457 | return 0; |
457 | } | 458 | } |
@@ -1070,6 +1071,50 @@ static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused) | |||
1070 | return 0; | 1071 | return 0; |
1071 | } | 1072 | } |
1072 | 1073 | ||
1074 | static int test__checkevent_pinned_modifier(struct perf_evlist *evlist) | ||
1075 | { | ||
1076 | struct perf_evsel *evsel = perf_evlist__first(evlist); | ||
1077 | |||
1078 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
1079 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
1080 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
1081 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); | ||
1082 | TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned); | ||
1083 | |||
1084 | return test__checkevent_symbolic_name(evlist); | ||
1085 | } | ||
1086 | |||
1087 | static int test__pinned_group(struct perf_evlist *evlist) | ||
1088 | { | ||
1089 | struct perf_evsel *evsel, *leader; | ||
1090 | |||
1091 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); | ||
1092 | |||
1093 | /* cycles - group leader */ | ||
1094 | evsel = leader = perf_evlist__first(evlist); | ||
1095 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
1096 | TEST_ASSERT_VAL("wrong config", | ||
1097 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); | ||
1098 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | ||
1099 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | ||
1100 | TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned); | ||
1101 | |||
1102 | /* cache-misses - can not be pinned, but will go on with the leader */ | ||
1103 | evsel = perf_evsel__next(evsel); | ||
1104 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
1105 | TEST_ASSERT_VAL("wrong config", | ||
1106 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); | ||
1107 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); | ||
1108 | |||
1109 | /* branch-misses - ditto */ | ||
1110 | evsel = perf_evsel__next(evsel); | ||
1111 | TEST_ASSERT_VAL("wrong config", | ||
1112 | PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config); | ||
1113 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); | ||
1114 | |||
1115 | return 0; | ||
1116 | } | ||
1117 | |||
1073 | static int count_tracepoints(void) | 1118 | static int count_tracepoints(void) |
1074 | { | 1119 | { |
1075 | char events_path[PATH_MAX]; | 1120 | char events_path[PATH_MAX]; |
@@ -1294,6 +1339,14 @@ static struct evlist_test test__events[] = { | |||
1294 | .name = "{instructions,branch-misses}:Su", | 1339 | .name = "{instructions,branch-misses}:Su", |
1295 | .check = test__leader_sample2, | 1340 | .check = test__leader_sample2, |
1296 | }, | 1341 | }, |
1342 | [40] = { | ||
1343 | .name = "instructions:uDp", | ||
1344 | .check = test__checkevent_pinned_modifier, | ||
1345 | }, | ||
1346 | [41] = { | ||
1347 | .name = "{cycles,cache-misses,branch-misses}:D", | ||
1348 | .check = test__pinned_group, | ||
1349 | }, | ||
1297 | }; | 1350 | }; |
1298 | 1351 | ||
1299 | static struct evlist_test test__events_pmu[] = { | 1352 | static struct evlist_test test__events_pmu[] = { |