7 #include <linux/jiffies.h>
8 #include <linux/compiler.h>
9 #include <linux/init.h>
10 #include <linux/module.h>
11 #include <linux/workqueue.h>
13 static atomic_t busy_wait
;
14 static struct delayed_work testwork
[NR_CPUS
];
17 static void do_work(struct work_struct
*work
)
21 int num_online
= num_online_cpus();
25 cpu1
= smp_processor_id();
26 printk("Busy waiting on cpu %d\n", cpu1
);
28 /* Prime busy_wait in cache */
29 for(i
=0; i
<100; i
++) {
30 copybusy
= atomic_read(&busy_wait
);
33 atomic_inc(&busy_wait
);
34 while(atomic_read(&busy_wait
) != num_online
) {
40 cpu2
= smp_processor_id();
42 printk("Cycle count on cpu %d is %llu\n", cpu1
, val
);
46 static int ltt_test_init(void)
50 printk(KERN_ALERT
"test init\n");
52 atomic_set(&busy_wait
, 0);
53 for_each_online_cpu(cpu
) {
54 INIT_DELAYED_WORK(&testwork
[cpu
], do_work
);
55 schedule_delayed_work_on(cpu
, &testwork
[cpu
], 0);
60 static void ltt_test_exit(void)
62 /* Test program... wait for output before unload */
63 printk(KERN_ALERT
"test exit\n");
66 module_init(ltt_test_init
)
67 module_exit(ltt_test_exit
)
69 MODULE_LICENSE("GPL");
70 MODULE_AUTHOR("Mathieu Desnoyers");
71 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
This page took 0.030741 seconds and 4 git commands to generate.