diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-17 14:40:36 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-23 09:27:47 +0200 |
commit | e3e3b871ee7f625bb65de0836490db73badce55e (patch) | |
tree | 44b220baf82cd92974181f0a9875f79db39588a9 /cpukit/libtest/testbusy.c | |
parent | libtest: Move <t.h> to <rtems/test.h> (diff) | |
download | rtems-e3e3b871ee7f625bb65de0836490db73badce55e.tar.bz2 |
libtest: Add T_busy()
Update #3199.
Diffstat (limited to 'cpukit/libtest/testbusy.c')
-rw-r--r-- | cpukit/libtest/testbusy.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/cpukit/libtest/testbusy.c b/cpukit/libtest/testbusy.c index e5218b0112..bf11b11632 100644 --- a/cpukit/libtest/testbusy.c +++ b/cpukit/libtest/testbusy.c @@ -19,6 +19,7 @@ #include <rtems/test-info.h> #include <rtems.h> +#include <rtems/test.h> #include <rtems/score/threadimpl.h> static uint_fast32_t estimate_busy_loop_maximum( void ) @@ -45,21 +46,6 @@ static uint_fast32_t wait_for_tick_change( void ) return now; } -/* - * It is important that we use actually use the same rtems_test_busy() function - * at the various places, since otherwise the obtained maximum value might be - * wrong. So, the compiler must not inline this function. - */ -RTEMS_NO_INLINE void rtems_test_busy( uint_fast32_t count ) -{ - uint_fast32_t i = 0; - - do { - __asm__ volatile (""); - ++i; - } while ( i < count ); -} - uint_fast32_t rtems_test_get_one_tick_busy_count( void ) { uint_fast32_t last; @@ -78,7 +64,7 @@ uint_fast32_t rtems_test_get_one_tick_busy_count( void ) while ( true ) { last = wait_for_tick_change(); - rtems_test_busy( b ); + T_busy( b ); now = rtems_clock_get_ticks_since_boot(); if ( now != last ) { @@ -94,7 +80,7 @@ uint_fast32_t rtems_test_get_one_tick_busy_count( void ) m = ( a + b ) / 2; last = wait_for_tick_change(); - rtems_test_busy( m ); + T_busy( m ); now = rtems_clock_get_ticks_since_boot(); if ( now != last ) { |