/* * rtems_cpu_usage_reset */ void rtems_cpu_usage_reset( void ) { #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset ); _Thread_Time_of_last_context_switch = CPU_usage_Uptime_at_last_reset; #else CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot; #endif rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler); }
/* * rtems_cpu_usage_reset */ void rtems_cpu_usage_reset( void ) { uint32_t cpu_count; uint32_t cpu_index; _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset ); cpu_count = rtems_get_processor_count(); for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); cpu->cpu_usage_timestamp = CPU_usage_Uptime_at_last_reset; } rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler); }
void sync(void) { /* * Walk the one used initially by RTEMS. */ _fwalk(_global_impure_ptr, sync_wrapper); /* * XXX Do we walk the one used globally by newlib? * XXX Do we need the RTEMS global one? */ /* * Now walk all the per-thread reentrancy structures. */ rtems_iterate_over_all_threads(sync_per_thread); }
static void rtems_bsd_dump_threads(void) { fprintf( stdout, "-------------------------------------------------------------------------------\n" " BSD THREADS\n" "------------+----------+-------------------------------------------------------\n" " ID | PRIORITY | NAME\n" "------------+----------+-------------------------------------------------------\n" ); rtems_iterate_over_all_threads(rtems_bsd_dump_thread); fprintf( stdout, "------------+----------+-------------------------------------------------------\n" ); }
rtems_task Init( rtems_task_argument ignored ) { void *tmp; puts( "\n\n*** TEST 41 ***" ); puts( "Init - overwrite internal value to trip case" ); tmp = _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ]; _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = NULL; puts( "Init - rtems_iterate_over_all_threads" ); rtems_iterate_over_all_threads(iterator); _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = tmp; puts( "*** END OF TEST 41 ***" ); rtems_test_exit(0); }
/* * rtems_cpu_usage_reset */ void rtems_cpu_usage_reset( void ) { #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ uint32_t processor_count; uint32_t processor; _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset ); processor_count = rtems_smp_get_processor_count(); for ( processor = 0 ; processor < processor_count ; ++processor ) { Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( processor ); per_cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset; } #else CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot; #endif rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler); }