update
[lttv.git] / tests / kernel / test-cmpxchg-nolock2.c
index c1bec8971f7b712dfb35d899c861384df7636ce7..52d1af85097aba3f7d683b0b22161327080dc51a 100644 (file)
@@ -131,6 +131,34 @@ static void do_test_disable_int(void)
        printk(KERN_ALERT "test end\n");
 }
 
+static void do_test_int(void)
+{
+       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++) {
+               local_irq_restore(flags);
+               local_irq_save(flags);
+       }
+       time2 = get_cycles();
+       local_irq_restore(flags);
+       preempt_enable();
+       time = time2 - time1;
+
+       printk(KERN_ALERT "test results: time for disabling/enabling interrupts (STI/CLI)\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 "-> enabling/disabling interrupts (STI/CLI) takes %llu cycles\n",
+                                       time);
+       printk(KERN_ALERT "test end\n");
+}
+
 
 
 static int ltt_test_init(void)
@@ -141,6 +169,7 @@ static int ltt_test_init(void)
        do_test_cmpxchg();
        do_test_enable_int();
        do_test_disable_int();
+       do_test_int();
        return -EAGAIN; /* Fail will directly unload the module */
 }
 
This page took 0.024345 seconds and 4 git commands to generate.