test
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 May 2006 13:28:37 +0000 (13:28 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 May 2006 13:28:37 +0000 (13:28 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1865 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/test-cmpxchg.c

index a2985567eb552277a504d2b4720222eccee32d8d..cd0e52e8aa190a76f2ae6ab2648d5abb20979be2 100644 (file)
@@ -1,11 +1,11 @@
 ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_LTT),)
-       obj-m += ltt-facility-loader-tests.o
-       obj-m += test-time-probe.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
+       #obj-m += ltt-facility-loader-tests.o
+       #obj-m += test-time-probe.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
        obj-m += test-cmpxchg.o
 endif
 
index a81663319c6f3af32749fd126254ab8d146383bb..16d56a519bac82cd563dea59c424650653c79692 100644 (file)
@@ -4,24 +4,28 @@
  */
 
 
+#include <linux/config.h>
+#include <linux/jiffies.h>
+#include <linux/compiler.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/ltt-core.h>
-#include <asm/system.h>
 
 #define NR_LOOPS 2000
 
-static volatile int test_val = 100;
+volatile int test_val = 100;
+
 
 static void do_test(void)
 {
-       int val;
+       int val, ret;
 
        val = test_val;
        
-       ret = cmpxchg(&test_val, val, 101);
+       ret = cmpxchg(&test_val, val, val+1);
 }
 
+void (*fct)(void) = do_test;
+
 static int ltt_test_init(void)
 {
        unsigned int i;
@@ -32,22 +36,25 @@ static int ltt_test_init(void)
        printk(KERN_ALERT "test init\n");
        
        local_irq_save(flags);
+       time1 = get_cycles();
        for(i=0; i<NR_LOOPS; i++) {
-               time1 = get_cycles();
+               //for(int j=0; j<10; j++) {
                do_test();
-               time2 = get_cycles();
-               time = time2 - time1;
-               max_time = max(max_time, time);
-               min_time = min(min_time, time);
-               tot_time += time;
+               //}
+               //max_time = max(max_time, time);
+               //min_time = min(min_time, time);
+               //printk("val : %d\n", test_val);
        }
+       time2 = get_cycles();
        local_irq_restore(flags);
+       time = time2 - time1;
+       tot_time += time;
 
        printk(KERN_ALERT "test results : time per probe\n");
        printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
        printk(KERN_ALERT "total time : %llu\n", tot_time);
-       printk(KERN_ALERT "min : %llu\n", min_time);
-       printk(KERN_ALERT "max : %llu\n", max_time);
+       //printk(KERN_ALERT "min : %llu\n", min_time);
+       //printk(KERN_ALERT "max : %llu\n", max_time);
 
        printk(KERN_ALERT "test end\n");
        
This page took 0.029004 seconds and 4 git commands to generate.