diff options
Diffstat (limited to 'cpukit/libtest/testbusy.c')
-rw-r--r-- | cpukit/libtest/testbusy.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/cpukit/libtest/testbusy.c b/cpukit/libtest/testbusy.c index bf11b11632..c1d44278be 100644 --- a/cpukit/libtest/testbusy.c +++ b/cpukit/libtest/testbusy.c @@ -18,81 +18,8 @@ #endif #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 ) -{ - uint_fast32_t units = 0; - uint_fast32_t initial = rtems_clock_get_ticks_since_boot(); - - while ( initial == rtems_clock_get_ticks_since_boot() ) { - ++units; - } - - return units; -} - -static uint_fast32_t wait_for_tick_change( void ) -{ - uint_fast32_t initial = rtems_clock_get_ticks_since_boot(); - uint_fast32_t now; - - do { - now = rtems_clock_get_ticks_since_boot(); - } while ( now == initial ); - - return now; -} - -uint_fast32_t rtems_test_get_one_tick_busy_count( void ) -{ - uint_fast32_t last; - uint_fast32_t now; - uint_fast32_t a; - uint_fast32_t b; - uint_fast32_t m; - - /* Choose a lower bound */ - a = 1; - - /* Estimate an upper bound */ - - wait_for_tick_change(); - b = 2 * estimate_busy_loop_maximum(); - - while ( true ) { - last = wait_for_tick_change(); - T_busy( b ); - now = rtems_clock_get_ticks_since_boot(); - - if ( now != last ) { - break; - } - - b *= 2; - last = now; - } - - /* Find a good value */ - do { - m = ( a + b ) / 2; - - last = wait_for_tick_change(); - T_busy( m ); - now = rtems_clock_get_ticks_since_boot(); - - if ( now != last ) { - b = m; - } else { - a = m; - } - } while ( b - a > 1 ); - - return m; -} - void rtems_test_busy_cpu_usage( time_t seconds, long nanoseconds ) { Thread_Control *executing; |