[rtems commit] sptests/spintrcritical_support: Optimize busy loop

Sebastian Huber sebh at rtems.org
Fri Sep 12 14:04:38 UTC 2014


Module:    rtems
Branch:    master
Commit:    f9eca790ac000fdbc91891252c7f81d2ebc79d0e
Changeset: http://git.rtems.org/rtems/commit/?id=f9eca790ac000fdbc91891252c7f81d2ebc79d0e

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 12 16:04:40 2014 +0200

sptests/spintrcritical_support: Optimize busy loop

---

 .../sptests/spintrcritical_support/intrcritical.c  |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/testsuites/sptests/spintrcritical_support/intrcritical.c b/testsuites/sptests/spintrcritical_support/intrcritical.c
index b6b2507..dec308f 100644
--- a/testsuites/sptests/spintrcritical_support/intrcritical.c
+++ b/testsuites/sptests/spintrcritical_support/intrcritical.c
@@ -59,11 +59,12 @@ static rtems_interval wait_for_tick_change( void )
  */
 static __attribute__( ( noinline ) ) void busy( rtems_interval max )
 {
-  rtems_interval i;
+  rtems_interval i = 0;
 
-  for ( i = 0; i < max; ++i ) {
+  do {
     __asm__ volatile ("");
-  }
+    ++i;
+  } while ( i < max );
 }
 
 static bool interrupt_critical_busy_wait( void )



More information about the vc mailing list