staticint test__tsc_is_supported(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{ if (!TSC_IS_SUPPORTED) {
pr_debug("Test not supported on this architecture\n"); return TEST_SKIP;
}
/* For hybrid "cycles:u", it creates two events */
evlist__for_each_entry(evlist, evsel) {
evsel->core.attr.comm = 1;
evsel->core.attr.disabled = 1;
evsel->core.attr.enable_on_exec = 0;
}
ret = evlist__open(evlist); if (ret < 0) { if (ret == -ENOENT)
err = TEST_SKIP; else
pr_debug("evlist__open() failed\n"); goto out_err;
}
CHECK__(evlist__mmap(evlist, UINT_MAX));
pc = evlist->mmap[0].core.base;
ret = perf_read_tsc_conversion(pc, &tc); if (ret) { if (ret == -EOPNOTSUPP) {
pr_debug("perf_read_tsc_conversion is not supported in current kernel\n");
err = TEST_SKIP;
} goto out_err;
}
evlist__enable(evlist);
comm1 = "Test COMM 1";
CHECK__(prctl(PR_SET_NAME, (unsignedlong)comm1, 0, 0, 0));
test_tsc = rdtsc();
comm2 = "Test COMM 2";
CHECK__(prctl(PR_SET_NAME, (unsignedlong)comm2, 0, 0, 0));
evlist__disable(evlist);
for (i = 0; i < evlist->core.nr_mmaps; i++) {
md = &evlist->mmap[i]; if (perf_mmap__read_init(&md->core) < 0) continue;
while ((event = perf_mmap__read_event(&md->core)) != NULL) { struct perf_sample sample;
staticstruct test_case time_to_tsc_tests[] = {
TEST_CASE_REASON("TSC support", tsc_is_supported, "This architecture does not support"),
TEST_CASE_REASON("Perf time to TSC", perf_time_to_tsc, "perf_read_tsc_conversion is not supported"),
{ .name = NULL, }
};
struct test_suite suite__perf_time_to_tsc = {
.desc = "Convert perf time to TSC",
.test_cases = time_to_tsc_tests,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.