add teest tsc sync
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 19 Mar 2007 03:55:36 +0000 (03:55 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 19 Mar 2007 03:55:36 +0000 (03:55 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2436 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/test-tsc-sync.c [new file with mode: 0644]

index 13af7220e31c07b4abb290b735a64a80c24007e1..541f917aedc28788f75f409887fef836a280edd7 100644 (file)
@@ -1,22 +1,25 @@
 ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_LTT),)
-       obj-m += ltt-facility-loader-tests.o
-#      obj-m += test-time-probe.o 
-       obj-m += test-time-probe2.o 
-       obj-m += test-compact.o 
+       #obj-m += ltt-facility-loader-tests.o
+#      #obj-m += test-time-probe.o 
+       #obj-m += test-time-probe2.o 
+       #obj-m += test-compact.o 
 #      obj-m += ltt-facility-loader-compact.o
 #      obj-m += test-instrument-size-small.o
 #      obj-m += test-instrument-size-med.o
 #      obj-m += test-instrument-size-big.o
 #      obj-m += test-printk-effect.o
 endif
-       obj-m += test-debugfs.o
+       obj-m += test-async-tsc.o
+       obj-m += test-tsc-sync.o
+       obj-m += test-hpet.o
+       #obj-m += test-debugfs.o
 #      obj-m += test-mod.o
 #      obj-m += atomic-pIII-cmx.o
-       obj-m += test-hotplug.o
-       obj-m += rdtsc-smp.o
-       obj-m += test-local.o
-       obj-m += test-ser.o
+       #obj-m += test-hotplug.o
+       #obj-m += rdtsc-smp.o
+       #obj-m += test-local.o
+       #obj-m += test-ser.o
 #      obj-m += test-cmpxchg.o
 #      obj-m += test-cmpxchg-nolock.o
 #      obj-m += test-spinlock.o
@@ -28,8 +31,8 @@ endif
        #obj-m += test-kprobes.o
        #obj-m += test-printk.o
        #obj-m += test-debugfs.o
-       obj-m += test-mark.o
-       obj-m += test-markxmc.o
+       #obj-m += test-mark.o
+       #obj-m += test-markxmc.o
 #      obj-m += probe.o
 #      obj-m += test-irqloop.o
        #obj-m += marker-loader.o
diff --git a/tests/kernel/test-tsc-sync.c b/tests/kernel/test-tsc-sync.c
new file mode 100644 (file)
index 0000000..5ca7e57
--- /dev/null
@@ -0,0 +1,61 @@
+/* test-tsc-sync.c
+ *
+ * Test TSC sync
+ */
+
+
+#include <linux/module.h>
+#include <linux/timer.h>
+#include <asm/timex.h>
+#include <linux/jiffies.h>
+
+static DEFINE_PER_CPU(cycles_t, count) = 0;
+
+static struct timer_list test_timer;
+
+/* IPI called on each CPU. */
+static void test_each(void *info)
+{
+       __get_cpu_var(count) = get_cycles();
+}
+
+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 %llu\n", cpu,
+                       per_cpu(count, 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("sync tsc test");
+
This page took 0.025818 seconds and 4 git commands to generate.