From 50035446fa78f78a7ad068d05d34df393281cbe8 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 8 May 2008 01:47:54 +0000 Subject: [PATCH] update git-svn-id: http://ltt.polymtl.ca/svn@2899 04897980-b3bd-0310-b5e0-8ef037075253 --- tests/kernel/test-trace-speed.c | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/kernel/test-trace-speed.c diff --git a/tests/kernel/test-trace-speed.c b/tests/kernel/test-trace-speed.c new file mode 100644 index 00000000..4537eb06 --- /dev/null +++ b/tests/kernel/test-trace-speed.c @@ -0,0 +1,64 @@ +/* test-mark.c + * + */ + +#include +#include +#include +#include +#include +#include + + //asm volatile (""); +struct proc_dir_entry *pentry = NULL; + +static inline 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; + + return 0; +} + +void cleanup_module(void) +{ + remove_proc_entry("testmark", NULL); +} + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Marker Test"); + -- 2.34.1