[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH XTF perf 4/4] perf: measure MMUEXT_MARK_SUPER test
A first simple test is to call a hypercall in a tight loop. To measure implementation aspects of the hypervisor, we picked a hypercall that is not implemented and hence results in a no-op, namely the hypercall mmuext_op with the command MMUEXT_MARK_SUPER. Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx> --- tests/perf-PV-MMUEXT_MARK_SUPER-noop/Makefile | 9 ++++ tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c | 66 +++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tests/perf-PV-MMUEXT_MARK_SUPER-noop/Makefile create mode 100644 tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c diff --git a/tests/perf-PV-MMUEXT_MARK_SUPER-noop/Makefile b/tests/perf-PV-MMUEXT_MARK_SUPER-noop/Makefile new file mode 100644 --- /dev/null +++ b/tests/perf-PV-MMUEXT_MARK_SUPER-noop/Makefile @@ -0,0 +1,9 @@ +include $(ROOT)/build/common.mk + +NAME := perf-PV-MMUEXT_MARK_SUPER-noop +CATEGORY := perf +TEST-ENVS := pv64 + +obj-perenv += main.o + +include $(ROOT)/build/gen.mk diff --git a/tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c b/tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c new file mode 100644 --- /dev/null +++ b/tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c @@ -0,0 +1,66 @@ +/** + * @file tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c + * @ref test-perf-PV-MMUEXT_MARK_SUPER-noop + * + * @page perf-PV-MMUEXT_MARK_SUPER-noop + * + * This test runs the hypercall mmuext_op with the command MMUEXT_MARK_SUPER in + * a tight loop, and measures how much time it takes for all loops. Finally, the + * test prints this time. + * + * Since this is a performance test, the actual value is furthermore printed + * using the predefined pattern on a separate line. The reported value + * represents the time it takes to run the mmuext_op hypercall in nano seconds. + * The average is calculated by using 500000000 calls. + * + * perf <testname> <value> + * + * @see tests/perf-PV-MMUEXT_MARK_SUPER-noop/main.c + */ + +#define MEASUREMENT_RETRIES 500000000 + +#include <xtf/time.h> +#include <xtf.h> + +const char test_title[] = "Test MMUEXT_MARK_SUPER"; + +/* Use a global struct to avoid local variables in call_MMUEXT_MARK_SUPER */ +mmuext_op_t op = +{ + .cmd = MMUEXT_MARK_SUPER, +}; + +/* Schedule a no-op hypercall */ +int call_MMUEXT_MARK_SUPER(void) +{ + return hypercall_mmuext_op(&op, 1, NULL, DOMID_SELF); +} + +void test_main(void) +{ + int rc = 0; + + /* Test whether the hypercall is implemented as expected */ + rc = hypercall_mmuext_op(&op, 1, NULL, DOMID_SELF); + if(rc != -EOPNOTSUPP) + return xtf_error("Unexpected MMUEXT_MARK_SUPER, rc %d\n", rc); + + /* Measure and print to screen how long calling this hypercall takes */ + measure_performance(test_title, + "mmuext_op(MMUEXT_MARK_SUPER, ...)", + MEASUREMENT_RETRIES, + call_MMUEXT_MARK_SUPER); + + return xtf_success("Success: performed MMUEXT_MARK_SUPER hypercall with expected result\n"); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.7.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |