7 #include <linux/module.h>
8 #include <linux/timer.h>
10 #include <linux/jiffies.h>
12 static DEFINE_PER_CPU(cycles_t
, count
) = 0;
14 static struct timer_list test_timer
;
16 /* IPI called on each CPU. */
17 static void test_each(void *info
)
19 __get_cpu_var(count
) = get_cycles();
22 static void do_test_timer(unsigned long data
)
26 /* Increment the counters */
27 on_each_cpu(test_each
, NULL
, 0, 1);
28 /* Read all the counters */
29 printk("Counters read from CPU %d\n", smp_processor_id());
30 for_each_online_cpu(cpu
) {
31 printk("Read : CPU %d, count %llu\n", cpu
,
34 del_timer(&test_timer
);
35 test_timer
.expires
= jiffies
+ 1000;
36 add_timer(&test_timer
);
39 static int __init
test_init(void)
41 /* initialize the timer that will increment the counter */
42 init_timer(&test_timer
);
43 test_timer
.function
= do_test_timer
;
44 test_timer
.expires
= jiffies
+ 1;
45 add_timer(&test_timer
);
50 static void __exit
test_exit(void)
52 del_timer_sync(&test_timer
);
55 module_init(test_init
);
56 module_exit(test_exit
);
58 MODULE_LICENSE("GPL");
59 MODULE_AUTHOR("Mathieu Desnoyers");
60 MODULE_DESCRIPTION("sync tsc test");
This page took 0.031665 seconds and 5 git commands to generate.