mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 06:56:52 +07:00
perf test: Add roundtrip test for hardware cache events
That nicely catches the problem reported by Joel Uckelman in http://permalink.gmane.org/gmane.linux.kernel.perf.user/1016 : [root@sandy ~]# perf test 1: vmlinux symtab matches kallsyms: Ok 2: detect open syscall event: Ok 3: detect open syscall event on all cpus: Ok 4: read samples using the mmap interface: Ok 5: parse events tests: Ok 6: x86 rdpmc test: Ok 7: Validate PERF_RECORD_* events & perf_sample fields: Ok 8: Test perf pmu format parsing: Ok 9: Test dso data interface: Ok 10: roundtrip evsel->name check: FAILED! [root@sandy ~]# perf test -v 10 10: roundtrip evsel->name check: --- start --- L1-dcache-misses != L1-dcache-load-misses L1-dcache-misses != L1-dcache-store-misses L1-dcache-misses != L1-dcache-prefetch-misses L1-icache-misses != L1-icache-load-misses L1-icache-misses != L1-icache-prefetch-misses LLC-misses != LLC-load-misses LLC-misses != LLC-store-misses LLC-misses != LLC-prefetch-misses dTLB-misses != dTLB-load-misses dTLB-misses != dTLB-store-misses dTLB-misses != dTLB-prefetch-misses iTLB-misses != iTLB-load-misses branch-misses != branch-load-misses node-misses != node-load-misses node-misses != node-store-misses node-misses != node-prefetch-misses ---- end ---- roundtrip evsel->name check: FAILED! [root@sandy ~]# Now lemme apply Jiri's fix and try it again... Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Joel Uckelman <joel@lightboxtechnologies.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-bbewtxw0rfipp5qy1j3jtg5d@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
78f067b38b
commit
49f20d723e
@ -1092,6 +1092,63 @@ static int test__perf_pmu(void)
|
||||
return perf_pmu__test();
|
||||
}
|
||||
|
||||
static int perf_evsel__roundtrip_cache_name_test(void)
|
||||
{
|
||||
char name[128];
|
||||
int type, op, err = 0, ret = 0, i, idx;
|
||||
struct perf_evsel *evsel;
|
||||
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
|
||||
|
||||
if (evlist == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
|
||||
for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
|
||||
/* skip invalid cache type */
|
||||
if (!perf_evsel__is_cache_op_valid(type, op))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
|
||||
__perf_evsel__hw_cache_type_op_res_name(type, op, i,
|
||||
name, sizeof(name));
|
||||
err = parse_events(evlist, name, 0);
|
||||
if (err)
|
||||
ret = err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
evsel = perf_evlist__first(evlist);
|
||||
|
||||
for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
|
||||
for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
|
||||
/* skip invalid cache type */
|
||||
if (!perf_evsel__is_cache_op_valid(type, op))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
|
||||
__perf_evsel__hw_cache_type_op_res_name(type, op, i,
|
||||
name, sizeof(name));
|
||||
if (evsel->idx != idx)
|
||||
continue;
|
||||
|
||||
++idx;
|
||||
|
||||
if (strcmp(perf_evsel__name(evsel), name)) {
|
||||
pr_debug("%s != %s\n", perf_evsel__name(evsel), name);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
evsel = perf_evsel__next(evsel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
perf_evlist__delete(evlist);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __perf_evsel__name_array_test(const char *names[], int nr_names)
|
||||
{
|
||||
int i, err;
|
||||
@ -1138,6 +1195,10 @@ static int perf_evsel__roundtrip_name_test(void)
|
||||
if (err)
|
||||
ret = err;
|
||||
|
||||
err = perf_evsel__roundtrip_cache_name_test();
|
||||
if (err)
|
||||
ret = err;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user