convert from svn repository: remove tags directory
[lttv.git] / trunk / tests / kernel / test-irqloop.c
1 /* test-irqloop
2 *
3 * Test time spent for irq disabling
4 */
5
6
7 #include <linux/jiffies.h>
8 #include <linux/compiler.h>
9 #include <linux/init.h>
10 #include <linux/module.h>
11
12 #define NR_LOOPS 20000
13
14 static int ltt_test_init(void)
15 {
16 unsigned int i;
17 cycles_t time1, time2, time;
18 cycles_t max_time = 0, min_time = 18446744073709551615ULL; /* (2^64)-1 */
19 cycles_t tot_time = 0;
20 unsigned long flags;
21 printk(KERN_ALERT "test init\n");
22
23 time1 = get_cycles();
24 for(i=0; i<NR_LOOPS; i++) {
25 local_irq_save(flags);
26 local_irq_restore(flags);
27 }
28 time2 = get_cycles();
29 time = time2 - time1;
30 tot_time += time;
31
32 printk(KERN_ALERT "test results : time for irq save/restore\n");
33 printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
34 printk(KERN_ALERT "total time : %llu\n", tot_time);
35 //printk(KERN_ALERT "min : %llu\n", min_time);
36 //printk(KERN_ALERT "max : %llu\n", max_time);
37
38 printk(KERN_ALERT "test end\n");
39
40 return -EAGAIN; /* Fail will directly unload the module */
41 }
42
43 static void ltt_test_exit(void)
44 {
45 printk(KERN_ALERT "test exit\n");
46 }
47
48 module_init(ltt_test_init)
49 module_exit(ltt_test_exit)
50
51 MODULE_LICENSE("GPL");
52 MODULE_AUTHOR("Mathieu Desnoyers");
53 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
54
This page took 0.030305 seconds and 4 git commands to generate.