X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=trunk%2Ftests%2Fkernel%2Ftest-local.c;fp=trunk%2Ftests%2Fkernel%2Ftest-local.c;h=0000000000000000000000000000000000000000;hb=31efe1f8304f09a4f4139c387a98d3215cd423c9;hp=967a4a2a84217f5aa07cc35ff9ce8e8807e24beb;hpb=27828bc1b0010ee87c2f68e31fb77fd4ae39fa6b;p=lttv.git diff --git a/trunk/tests/kernel/test-local.c b/trunk/tests/kernel/test-local.c deleted file mode 100644 index 967a4a2a..00000000 --- a/trunk/tests/kernel/test-local.c +++ /dev/null @@ -1,69 +0,0 @@ -/* test-local.c - * - * Sample module for local.h usage. - */ - - -#include -#include -#include - -static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0); - -static struct timer_list test_timer; - -/* IPI called on each CPU. */ -static void test_each(void *info) -{ - /* Increment the counter from a non preemptible context */ - printk("Increment on cpu %d\n", smp_processor_id()); - local_inc(&__get_cpu_var(counters)); - - /* This is what incrementing the variable would look like within a - * preemptible context (it disables preemption) : - * - * local_inc(&get_cpu_var(counters)); - * put_cpu_var(counters); - */ -} - -static void do_test_timer(unsigned long data) -{ - int cpu; - - /* Increment the counters */ - on_each_cpu(test_each, NULL, 0, 1); - /* Read all the counters */ - printk("Counters read from CPU %d\n", smp_processor_id()); - for_each_online_cpu(cpu) { - printk("Read : CPU %d, count %ld\n", cpu, - local_read(&per_cpu(counters, cpu))); - } - del_timer(&test_timer); - test_timer.expires = jiffies + 1000; - add_timer(&test_timer); -} - -static int __init test_init(void) -{ - /* initialize the timer that will increment the counter */ - init_timer(&test_timer); - test_timer.function = do_test_timer; - test_timer.expires = jiffies + 1; - add_timer(&test_timer); - - return 0; -} - -static void __exit test_exit(void) -{ - del_timer_sync(&test_timer); -} - -module_init(test_init); -module_exit(test_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Mathieu Desnoyers"); -MODULE_DESCRIPTION("Local Atomic Ops"); -