tools/perf/tests/wp.c

Source file repositories/reference/linux-study-clean/tools/perf/tests/wp.c

File Facts

System
Linux kernel
Corpus path
tools/perf/tests/wp.c
Extension
.c
Size
5094 bytes
Lines
215
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

if (errno == ENOTTY) {
			test->test_cases[subtest].skip_reason = "missing kernel support";
			ret = TEST_SKIP;
		}

		pr_debug("ioctl(PERF_EVENT_IOC_MODIFY_ATTRIBUTES) failed\n");
		close(fd);
		return ret;
	}

	data2[1] = tmp; /* Not Counted */
	WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1);

	/* Enable the event */
	ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
	if (ret < 0) {
		pr_debug("Failed to enable event\n");
		close(fd);
		return ret;
	}

	data2[1] = tmp; /* Counted */
	WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2);

	data2[2] = tmp; /* Not Counted */
	WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2);

	close(fd);
	return 0;
#endif
}

static struct test_case wp_tests[] = {
	TEST_CASE_REASON("Read Only Watchpoint", wp_ro, "missing hardware support"),
	TEST_CASE_REASON("Write Only Watchpoint", wp_wo, "missing hardware support"),
	TEST_CASE_REASON("Read / Write Watchpoint", wp_rw, "missing hardware support"),
	TEST_CASE_REASON("Modify Watchpoint", wp_modify, "missing hardware support"),
	{ .name = NULL, }
};

struct test_suite suite__wp = {
	.desc = "Watchpoint",
	.test_cases = wp_tests,
};

Annotation

Implementation Notes