obj-m += test-mark-speed-edit.o
obj-m += test-mark-speed-opt.o
obj-m += test-mark-speed-local.o
+ obj-m += cachectl.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
--- /dev/null
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+int init_module()
+{
+ unsigned tmp;
+
+ /* Disable cache */
+
+ asm volatile ("movl %%cr0, %0\n\t"
+ "orl $0x40000000, %0\n\t"
+ "wbinvd\n\t"
+ "movl %0, %%cr0\n\t"
+ "wbinvd\n\t"
+ : "=r" (tmp) : : "memory");
+
+ return 0;
+}
+
+void cleanup_module()
+{
+ unsigned tmp;
+
+ asm volatile ("movl %%cr0, %0\n\t"
+ "andl $0xbfffffff, %0\n\t"
+ "wbinvd\n\t"
+ "movl %0, %%cr0\n\t"
+ "wbinvd\n\t"
+ : "=r" (tmp) : : "memory");
+}
RESNOPLOCAL=`dmesg |grep "cycles : " |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'`
-make clean
-make EXTRA_CFLAGS=-DCACHEFLUSH
+#make clean
+#make EXTRA_CFLAGS=-DCACHEFLUSH
+
+modprobe cachectl
insmod test-mark-speed-empty.ko
cat /proc/testmark
RESNOPLOCALFL=`dmesg |grep "cycles : " |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'`
+rmmod cachectl
echo "Results in cycles per loop"