Hi, _Thread_Idle has been removed. I don't think there is a direct handle available for the idle threads anymore. You should see the IDLE thread in the cpuuse report. If you need to find the idle threads specifically you might be able to loop through the Object tables (like the cpuuse report does) and compare the name with IDLE. Directly accessing _Thread_Idle (and the Object tables) like this is a violation of the RTEMS userspace API.
If a compelling reason for a direct handle to the idle thread is given, it may be possible for RTEMS to store such a handle in the per-cpu tables, which was done previously but was removed. -Gedare On Wed, Jan 8, 2014 at 9:53 AM, Giovanni Macciocu <g.macci...@sron.nl> wrote: > Hi All, > > details: > > Rtems head: 7 Jan. 2014 > BSP: xilinx_zynq_zedboard > Goal: cpu_idle_report_implementation > > I'm adjusting a piece of code we've used succesfully with rtems 4.9 and rtems > 4.10 in combination with the Sparc BSP (Leon processor). > This code is used to measure the idle time of the processor. > I'm adjusting this code in order to be used with the recent rtems head of 7 > Jan. 2014 and the BSP of the xilinx_zynq_zedboard > > I've added the following include > #include <rtems/score/objectimpl.h> > in order to access the 'Object_Information' object > > The only problem I'm still having is that I cannot find an equal > implementation of '_Thread_Idle' > in rtems 4.9 and 4.10 (sparc bsp) this is implemented at line 435 of > sparc-rtems4.10/include/rtems/score/thread.h (SCORE_EXTERN Thread_Control > *Thread_Idle;) > however in 4.11 with the xilinx_zynq_zedboard bsp I cannot find a similar > implementation. > > file: rtems/cpukit/libmisc/cpuuse/cpuidlereport.c > > // CPU Usage Reporter > > #ifdef HAVE_CONFIG_H > #include "config.h" > #endif > > #include <rtems.h> > > #include <assert.h> > #include <string.h> > #include <stdlib.h> > #include <stdio.h> > #include <ctype.h> > #include <inttypes.h> > > #include <rtems/cpuuse.h> > #include <rtems/bspIo.h> > > // added this in v4.11 in order to acces 'Objects_Information' > #include <rtems/score/objectimpl.h> > > #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) > #include <rtems/score/timespec.h> > #endif > > #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS > extern struct timespec CPU_usage_Uptime_at_last_reset; > #endif > > uint32_t rtems_cpu_idle_report( void ) > { > uint32_t ival, fval, promille = 1000; > > /* > * When not using nanosecond CPU usage resolution, we have to count > * the number of "ticks" we gave credit for to give the user a rough > * guideline as to what each number means proportionally. > */ > #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS > > struct timespec uptime, total, rane/ > > _TOD_Get_uptime( &uptime ); > _Timespec_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); > > ran = _Thread_Idle->cpu_time_used; > _Timespec_Divide( &ran, &total, &ival, &fval ); > > #else > > uint32_t i; > uint32_t api_index; > Thread_Control *the_thread; > Objects_Information *information; > uint32_t total_units = 0; > > for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { > > if ( !_Objects_Information_table[ api_index ] ) > continue; > information = _Objects_Information_table[ api_index ][ 1 ]; > if ( information ) { > for ( i=1 ; i <= information->maximum ; i++ ) { > the_thread = (Thread_Control *)information->local_table[ i ]; > > if ( the_thread ) > total_units += the_thread->cpu_time_used; > } > } > } > > ival = (total_units) ? _Thread_Idle->cpu_time_used * 10000 / total_units : > 0; > fval = ival % 100; > ival /= 100; > > #endif > > promille = ival * 10 + fval / 100; > return promille; > } > > Any ideas on what I'm missing here? > > Thanks, > > Giovanni Macciocu, Software Design Engineer > SRON Netherlands Institute for Space Research > > > > _______________________________________________ > rtems-devel mailing list > rtems-devel@rtems.org > http://www.rtems.org/mailman/listinfo/rtems-devel _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel