update
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 May 2008 01:20:06 +0000 (01:20 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 8 May 2008 01:20:06 +0000 (01:20 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2897 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/test-cmpxchg-nolock2.c

index 52d1af85097aba3f7d683b0b22161327080dc51a..fcae83e44fd546acefd4bd1e910d58b5bb207120 100644 (file)
 
 int test_val;
 
+static void do_testbaseline(void)
+{
+       int ret;
+       long flags;
+       unsigned int i;
+       cycles_t time1, time2, time;
+       long rem;
+
+       local_irq_save(flags);
+       preempt_disable();
+       time1 = get_cycles();
+       for (i = 0; i < NR_LOOPS; i++) {
+               asm volatile ("");
+       }
+       time2 = get_cycles();
+       local_irq_restore(flags);
+       preempt_enable();
+       time = time2 - time1;
+
+       printk(KERN_ALERT "test results: time for baseline\n");
+       printk(KERN_ALERT "number of loops: %d\n", NR_LOOPS);
+       printk(KERN_ALERT "total time: %llu\n", time);
+       time = div_long_long_rem(time, NR_LOOPS, &rem);
+       printk(KERN_ALERT "-> baseline takes %llu cycles\n", time);
+       printk(KERN_ALERT "test end\n");
+}
+
 static void do_test_sync_cmpxchg(void)
 {
        int ret;
@@ -165,6 +192,7 @@ static int ltt_test_init(void)
 {
        printk(KERN_ALERT "test init\n");
        
+       do_testbaseline();
        do_test_sync_cmpxchg();
        do_test_cmpxchg();
        do_test_enable_int();
This page took 0.024187 seconds and 4 git commands to generate.