From 12b8274f1b591638f847397625699699f9e44423 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 13 Aug 2008 16:55:31 +0000 Subject: [PATCH] update test git-svn-id: http://ltt.polymtl.ca/svn@3012 04897980-b3bd-0310-b5e0-8ef037075253 --- trunk/tests/kernel/Makefile | 13 ++-- trunk/tests/kernel/test-nop-speed.c | 104 ++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 trunk/tests/kernel/test-nop-speed.c diff --git a/trunk/tests/kernel/Makefile b/trunk/tests/kernel/Makefile index a246c501..5d68be3a 100644 --- a/trunk/tests/kernel/Makefile +++ b/trunk/tests/kernel/Makefile @@ -14,12 +14,13 @@ ifneq ($(CONFIG_LTT),) endif #obj-m += test-sys_call.o # obj-m += test-bug.o - obj-m += test-cmpxchg-nolock2.o - obj-m += test-trace-speed.o - obj-m += test-rcu-speed.o - obj-m += test-fct-speed.o - obj-m += test-int3-speed.o - obj-m += test-kprobes2.o + obj-m += test-nop-speed.o +# obj-m += test-cmpxchg-nolock2.o +# obj-m += test-trace-speed.o +# obj-m += test-rcu-speed.o +# obj-m += test-fct-speed.o +# obj-m += test-int3-speed.o +# obj-m += test-kprobes2.o #obj-m += test-mark-speed.o #obj-m += test-mark-speed-edit.o #obj-m += test-mark-speed-opt.o diff --git a/trunk/tests/kernel/test-nop-speed.c b/trunk/tests/kernel/test-nop-speed.c new file mode 100644 index 00000000..f75af525 --- /dev/null +++ b/trunk/tests/kernel/test-nop-speed.c @@ -0,0 +1,104 @@ +/* test-nop-speed.c + * + */ + +#include +#include +#include +#include +#include +#include + +#define NR_TESTS 20000 + +struct proc_dir_entry *pentry = NULL; + +void empty(void) +{ + asm volatile (""); +} + +void twobytesjump(void) +{ + asm volatile ("jmp 1f\n\t" + ".byte 0x00, 0x00, 0x00\n\t" + "1:\n\t"); +} + +void fivebytesjump(void) +{ + asm (".byte 0xe9, 0x00, 0x00, 0x00, 0x00\n\t"); +} + +void threetwonops(void) +{ + asm (".byte 0x66,0x66,0x90,0x66,0x90\n\t"); +} + +void fivebytesnop(void) +{ + asm (".byte 0x66,0x66,0x66,0x66,0x90\n\t"); +} + +void fivebytespsixnop(void) +{ + asm (".byte 0x0f,0x1f,0x44,0x00,0\n\t"); +} + +void perform_test(const char *name, void (*callback)(void)) +{ + unsigned int i; + cycles_t cycles1, cycles2; + unsigned long flags; + + local_irq_save(flags); + rdtsc_barrier(); + cycles1 = get_cycles(); + rdtsc_barrier(); + for(i=0; iproc_fops = &my_operations; + + return 0; +} + +void cleanup_module(void) +{ + remove_proc_entry("testnops", NULL); +} + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Marker Test"); + -- 2.34.1