update test
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 May 2009 20:52:04 +0000 (20:52 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 May 2009 20:52:04 +0000 (20:52 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@3395 04897980-b3bd-0310-b5e0-8ef037075253

trunk/tests/kernel/test-read-lock-speed.c

index 26c086247637c209264ac186241f8c301df8d6c4..f6ad286e74ce08b2801f5466d47604bf5644bafc 100644 (file)
 #include <asm/timex.h>
 #include <asm/system.h>
 
+#ifdef CONFIG_ARM
+#include <linux/trace-clock.h>
+#define get_timestamp  trace_clock_read64
+#else
+#define get_timestamp  get_cycles
+#endif
+
 #define NR_LOOPS 20000
 
 #ifndef CONFIG_PREEMPT
@@ -51,11 +58,11 @@ static void do_testbaseline(void)
 
        local_irq_save(flags);
        preempt_disable();
-       time1 = get_cycles();
+       time1 = get_timestamp();
        for (i = 0; i < NR_LOOPS; i++) {
                asm volatile ("");
        }
-       time2 = get_cycles();
+       time2 = get_timestamp();
        local_irq_restore(flags);
        preempt_enable();
        time = time2 - time1;
@@ -78,12 +85,12 @@ static void do_test_spinlock(void)
 
        preempt_disable();
        spin_lock_irqsave(&mylock, flags);
-       time1 = get_cycles();
+       time1 = get_timestamp();
        for (i = 0; i < NR_LOOPS; i++) {
                spin_unlock(&mylock);
                spin_lock(&mylock);
        }
-       time2 = get_cycles();
+       time2 = get_timestamp();
        spin_unlock_irqrestore(&mylock, flags);
        preempt_enable();
        time = time2 - time1;
@@ -107,12 +114,12 @@ static void do_test_read_rwlock(void)
        preempt_disable();
        local_irq_save(flags);
        read_lock(&mylock);
-       time1 = get_cycles();
+       time1 = get_timestamp();
        for (i = 0; i < NR_LOOPS; i++) {
                read_unlock(&mylock);
                read_lock(&mylock);
        }
-       time2 = get_cycles();
+       time2 = get_timestamp();
        read_unlock(&mylock);
        local_irq_restore(flags);
        preempt_enable();
@@ -136,13 +143,13 @@ static void do_test_seqlock(void)
        u32 rem;
 
        local_irq_save(flags);
-       time1 = get_cycles();
+       time1 = get_timestamp();
        for (i = 0; i < NR_LOOPS; i++) {
                do {
                        seq = read_seqbegin(&test_lock);
                } while (read_seqretry(&test_lock, seq));
        }
-       time2 = get_cycles();
+       time2 = get_timestamp();
        time = time2 - time1;
        local_irq_restore(flags);
 
@@ -169,12 +176,12 @@ static void do_test_preempt(void)
 
        local_irq_save(flags);
        preempt_disable();
-       time1 = get_cycles();
+       time1 = get_timestamp();
        for (i = 0; i < NR_LOOPS; i++) {
                preempt_disable();
                preempt_enable();
        }
-       time2 = get_cycles();
+       time2 = get_timestamp();
        preempt_enable();
        time = time2 - time1;
        local_irq_restore(flags);
This page took 0.025274 seconds and 4 git commands to generate.