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>
13 #define NR_LOOPS 10000000
15 struct proc_dir_entry
*pentry
= NULL
;
17 static int my_open(struct inode
*inode
, struct file
*file
)
21 cycles_t time1
, time2
;
23 local_irq_save(flags
);
25 for(i
=0; i
<NR_LOOPS
; i
++) {
26 // MARK(subsys_mark1, "%d %p", 1, NULL);
29 local_irq_restore(flags
);
30 printk("time delta (cycles): %llu\n", time2
-time1
);
36 static struct file_operations my_operations
= {
42 pentry
= create_proc_entry("testmark", 0444, NULL
);
44 pentry
->proc_fops
= &my_operations
;
49 void cleanup_module(void)
51 remove_proc_entry("testmark", NULL
);
54 MODULE_LICENSE("GPL");
55 MODULE_AUTHOR("Mathieu Desnoyers");
56 MODULE_DESCRIPTION("Marker Test");