a81663319c6f3af32749fd126254ab8d146383bb
3 * Test time spent in a LTTng instrumentation probe.
7 #include <linux/init.h>
8 #include <linux/module.h>
9 #include <linux/ltt-core.h>
10 #include <asm/system.h>
14 static volatile int test_val
= 100;
16 static void do_test(void)
22 ret
= cmpxchg(&test_val
, val
, 101);
25 static int ltt_test_init(void)
28 cycles_t time1
, time2
, time
;
29 cycles_t max_time
= 0, min_time
= 18446744073709551615ULL; /* (2^64)-1 */
30 cycles_t tot_time
= 0;
32 printk(KERN_ALERT
"test init\n");
34 local_irq_save(flags
);
35 for(i
=0; i
<NR_LOOPS
; i
++) {
40 max_time
= max(max_time
, time
);
41 min_time
= min(min_time
, time
);
44 local_irq_restore(flags
);
46 printk(KERN_ALERT
"test results : time per probe\n");
47 printk(KERN_ALERT
"number of loops : %d\n", NR_LOOPS
);
48 printk(KERN_ALERT
"total time : %llu\n", tot_time
);
49 printk(KERN_ALERT
"min : %llu\n", min_time
);
50 printk(KERN_ALERT
"max : %llu\n", max_time
);
52 printk(KERN_ALERT
"test end\n");
54 return -EAGAIN
; /* Fail will directly unload the module */
57 static void ltt_test_exit(void)
59 printk(KERN_ALERT
"test exit\n");
62 module_init(ltt_test_init
)
63 module_exit(ltt_test_exit
)
65 MODULE_LICENSE("GPL");
66 MODULE_AUTHOR("Mathieu Desnoyers");
67 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
This page took 0.045799 seconds and 4 git commands to generate.