update
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 May 2008 02:00:37 +0000 (02:00 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 May 2008 02:00:37 +0000 (02:00 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2900 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/test-fct-speed.c [new file with mode: 0644]

index 457c543f43496bd141e614511f6767d2ea7b1a6a..c9732c10930f00ce5c1ea78383ff9f1c82e25c13 100644 (file)
@@ -16,6 +16,7 @@ endif
 #      obj-m += test-bug.o
        obj-m += test-cmpxchg-nolock2.o
        obj-m += test-trace-speed.o
+       obj-m += test-fct-speed.o
        #obj-m += test-mark-speed.o
        #obj-m += test-mark-speed-edit.o
        #obj-m += test-mark-speed-opt.o
diff --git a/tests/kernel/test-fct-speed.c b/tests/kernel/test-fct-speed.c
new file mode 100644 (file)
index 0000000..079e479
--- /dev/null
@@ -0,0 +1,65 @@
+/* test-mark.c
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/sched.h>
+#include <linux/timex.h>
+#include <linux/marker.h>
+#include <asm/ptrace.h>
+
+       //asm volatile ("");
+struct proc_dir_entry *pentry = NULL;
+
+void test(unsigned long arg)
+{
+       asm volatile ("");
+       //trace_mark(test_marker, "arg1 %lu arg2 %p", arg, current);
+}
+
+static int my_open(struct inode *inode, struct file *file)
+{
+       unsigned int i;
+       cycles_t cycles1, cycles2;
+       unsigned long flags;
+
+       local_irq_save(flags);
+       rdtsc_barrier();
+       cycles1 = get_cycles();
+       rdtsc_barrier();
+       for(i=0; i<20000; i++) {
+               test(i);
+       }
+       rdtsc_barrier();
+       cycles2 = get_cycles();
+       rdtsc_barrier();
+       local_irq_restore(flags);
+       printk("cycles : %llu\n", cycles2-cycles1);
+       return -EPERM;
+}
+
+
+static struct file_operations my_operations = {
+       .open = my_open,
+};
+
+int init_module(void)
+{
+       pentry = create_proc_entry("testmark", 0444, NULL);
+       if (pentry)
+               pentry->proc_fops = &my_operations;
+
+       printk("test addr %p\n", &test);
+       return 0;
+}
+
+void cleanup_module(void)
+{
+       remove_proc_entry("testmark", NULL);
+}
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Marker Test");
+
This page took 0.024757 seconds and 4 git commands to generate.