mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 00:51:35 +00:00
perf tests: Adding automated parsing tests for group :GH modifiers
The ':GH' group modifier handling was just recently fixed, adding some autommated tests to keep it that way. Adding tests for following events: "{cycles,cache-misses:G}:H" "{cycles,cache-misses:H}:G" "{cycles:G,cache-misses:H}:u" "{cycles:G,cache-misses:H}:uG" Plus fixing test__group2 test. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> 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/r/1359971803-2343-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
89bb67ff93
commit
5a30a99fb4
1 changed files with 177 additions and 1 deletions
|
@ -577,7 +577,7 @@ static int test__group2(struct perf_evlist *evlist)
|
||||||
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||||
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||||
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||||
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||||
|
@ -811,6 +811,166 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int test__group_gh1(struct perf_evlist *evlist)
|
||||||
|
{
|
||||||
|
struct perf_evsel *evsel, *leader;
|
||||||
|
|
||||||
|
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
|
||||||
|
TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
|
||||||
|
|
||||||
|
/* cycles + :H group modifier */
|
||||||
|
evsel = leader = perf_evlist__first(evlist);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
|
||||||
|
TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
|
||||||
|
|
||||||
|
/* cache-misses:G + :H group modifier */
|
||||||
|
evsel = perf_evsel__next(evsel);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int test__group_gh2(struct perf_evlist *evlist)
|
||||||
|
{
|
||||||
|
struct perf_evsel *evsel, *leader;
|
||||||
|
|
||||||
|
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
|
||||||
|
TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
|
||||||
|
|
||||||
|
/* cycles + :G group modifier */
|
||||||
|
evsel = leader = perf_evlist__first(evlist);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
|
||||||
|
TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
|
||||||
|
|
||||||
|
/* cache-misses:H + :G group modifier */
|
||||||
|
evsel = perf_evsel__next(evsel);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int test__group_gh3(struct perf_evlist *evlist)
|
||||||
|
{
|
||||||
|
struct perf_evsel *evsel, *leader;
|
||||||
|
|
||||||
|
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
|
||||||
|
TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
|
||||||
|
|
||||||
|
/* cycles:G + :u group modifier */
|
||||||
|
evsel = leader = perf_evlist__first(evlist);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
|
||||||
|
TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
|
||||||
|
|
||||||
|
/* cache-misses:H + :u group modifier */
|
||||||
|
evsel = perf_evsel__next(evsel);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int test__group_gh4(struct perf_evlist *evlist)
|
||||||
|
{
|
||||||
|
struct perf_evsel *evsel, *leader;
|
||||||
|
|
||||||
|
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
|
||||||
|
TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
|
||||||
|
|
||||||
|
/* cycles:G + :uG group modifier */
|
||||||
|
evsel = leader = perf_evlist__first(evlist);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
|
||||||
|
TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
|
||||||
|
|
||||||
|
/* cache-misses:H + :uG group modifier */
|
||||||
|
evsel = perf_evsel__next(evsel);
|
||||||
|
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
|
||||||
|
TEST_ASSERT_VAL("wrong config",
|
||||||
|
PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||||
|
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||||
|
TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
|
||||||
|
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||||
|
TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int count_tracepoints(void)
|
static int count_tracepoints(void)
|
||||||
{
|
{
|
||||||
char events_path[PATH_MAX];
|
char events_path[PATH_MAX];
|
||||||
|
@ -1011,6 +1171,22 @@ static struct evlist_test test__events[] = {
|
||||||
.name = "*:*",
|
.name = "*:*",
|
||||||
.check = test__all_tracepoints,
|
.check = test__all_tracepoints,
|
||||||
},
|
},
|
||||||
|
[34] = {
|
||||||
|
.name = "{cycles,cache-misses:G}:H",
|
||||||
|
.check = test__group_gh1,
|
||||||
|
},
|
||||||
|
[35] = {
|
||||||
|
.name = "{cycles,cache-misses:H}:G",
|
||||||
|
.check = test__group_gh2,
|
||||||
|
},
|
||||||
|
[36] = {
|
||||||
|
.name = "{cycles:G,cache-misses:H}:u",
|
||||||
|
.check = test__group_gh3,
|
||||||
|
},
|
||||||
|
[37] = {
|
||||||
|
.name = "{cycles:G,cache-misses:H}:uG",
|
||||||
|
.check = test__group_gh4,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct evlist_test test__events_pmu[] = {
|
static struct evlist_test test__events_pmu[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue