tools/perf/arch/x86/tests/topdown.c

Source file repositories/reference/linux-study-clean/tools/perf/arch/x86/tests/topdown.c

File Facts

System
Linux kernel
Corpus path
tools/perf/arch/x86/tests/topdown.c
Extension
.c
Size
2255 bytes
Lines
79
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

strcasestr(name, "topdown.slots_p")) {
			if (arch_is_topdown_slots(evsel) || arch_is_topdown_metrics(evsel))
				fail = true;
		} else if (strcasestr(name, "slots")) {
			if (arch_is_topdown_slots(evsel) != p_core_pmu ||
			    arch_is_topdown_metrics(evsel))
				fail = true;
		} else if (strcasestr(name, "topdown")) {
			if (arch_is_topdown_slots(evsel) ||
			    arch_is_topdown_metrics(evsel) != p_core_pmu)
				fail = true;
		} else if (arch_is_topdown_slots(evsel) || arch_is_topdown_metrics(evsel)) {
			fail = true;
		}
		if (fail) {
			pr_debug("Broken topdown information for '%s'\n", evsel__name(evsel));
			*ret = TEST_FAIL;
		}
	}
	evlist__delete(evlist);
	return 0;
}

static int test__x86_topdown(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
	int ret = TEST_OK;
	struct perf_pmu *pmu = NULL;

	if (!topdown_sys_has_perf_metrics())
		return TEST_OK;

	while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
		if (perf_pmu__for_each_event(pmu, /*skip_duplicate_pmus=*/false, &ret, event_cb))
			break;
	}
	return ret;
}

DEFINE_SUITE("x86 topdown", x86_topdown);

Annotation

Implementation Notes