16d56a519bac82cd563dea59c424650653c79692
3 * Test time spent in a LTTng instrumentation probe.
7 #include <linux/config.h>
8 #include <linux/jiffies.h>
9 #include <linux/compiler.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
15 volatile int test_val
= 100;
18 static void do_test(void)
24 ret
= cmpxchg(&test_val
, val
, val
+1);
27 void (*fct
)(void) = do_test
;
29 static int ltt_test_init(void)
32 cycles_t time1
, time2
, time
;
33 cycles_t max_time
= 0, min_time
= 18446744073709551615ULL; /* (2^64)-1 */
34 cycles_t tot_time
= 0;
36 printk(KERN_ALERT
"test init\n");
38 local_irq_save(flags
);
40 for(i
=0; i
<NR_LOOPS
; i
++) {
41 //for(int j=0; j<10; j++) {
44 //max_time = max(max_time, time);
45 //min_time = min(min_time, time);
46 //printk("val : %d\n", test_val);
49 local_irq_restore(flags
);
53 printk(KERN_ALERT
"test results : time per probe\n");
54 printk(KERN_ALERT
"number of loops : %d\n", NR_LOOPS
);
55 printk(KERN_ALERT
"total time : %llu\n", tot_time
);
56 //printk(KERN_ALERT "min : %llu\n", min_time);
57 //printk(KERN_ALERT "max : %llu\n", max_time);
59 printk(KERN_ALERT
"test end\n");
61 return -EAGAIN
; /* Fail will directly unload the module */
64 static void ltt_test_exit(void)
66 printk(KERN_ALERT
"test exit\n");
69 module_init(ltt_test_init
)
70 module_exit(ltt_test_exit
)
72 MODULE_LICENSE("GPL");
73 MODULE_AUTHOR("Mathieu Desnoyers");
74 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
This page took 0.04416 seconds and 4 git commands to generate.