marker tests
[lttv.git] / tests / markers / test-micro-loop-probe.c
diff --git a/tests/markers/test-micro-loop-probe.c b/tests/markers/test-micro-loop-probe.c
new file mode 100644 (file)
index 0000000..7340278
--- /dev/null
@@ -0,0 +1,57 @@
+/* test-micro-loop-marker.c
+ *
+ * Execute a marker in a loop
+ */
+
+#include <linux/marker.h>
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/sched.h>
+#include <asm/ptrace.h>
+#include <linux/timex.h>
+
+#define NR_LOOPS 100000
+
+struct proc_dir_entry *pentry = NULL;
+
+static int my_open(struct inode *inode, struct file *file)
+{
+       volatile unsigned int i;
+       unsigned long flags;
+       cycles_t time1, time2;
+
+       local_irq_save(flags);
+       time1 = get_cycles();
+       for(i=0; i<NR_LOOPS; i++) {
+               MARK(subsys_mark1, "%d %p", 1, NULL);
+       }
+       time2 = get_cycles();
+       local_irq_restore(flags);
+       printk("time delta (cycles): %llu\n", time2-time1);
+
+       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;
+
+       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.023099 seconds and 4 git commands to generate.