1 /* test-micro-loop-marker.c
3 * Execute a marker in a loop
6 #include <linux/marker.h>
7 #include <linux/module.h>
8 #include <linux/proc_fs.h>
9 #include <linux/sched.h>
10 #include <asm/ptrace.h>
11 #include <linux/timex.h>
12 #include <linux/string.h>
14 #define NR_LOOPS 100000
19 char src
[COPYLEN
] = "aaaaaaaaaaaa";
21 struct proc_dir_entry
*pentry
= NULL
;
23 static int my_open(struct inode
*inode
, struct file
*file
)
27 cycles_t time1
, time2
;
29 local_irq_save(flags
);
31 for(i
=0; i
<NR_LOOPS
; i
++) {
32 MARK(subsys_mark1
, "%d %p", 1, NULL
);
33 //memcpy(test, src, COPYLEN);
36 local_irq_restore(flags
);
37 printk("time delta (cycles): %llu\n", time2
-time1
);
43 static struct file_operations my_operations
= {
49 pentry
= create_proc_entry("testmark", 0444, NULL
);
51 pentry
->proc_fops
= &my_operations
;
56 void cleanup_module(void)
58 remove_proc_entry("testmark", NULL
);
61 MODULE_LICENSE("GPL");
62 MODULE_AUTHOR("Mathieu Desnoyers");
63 MODULE_DESCRIPTION("Marker Test");