This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions about cpuload package and idle thread.


On Fri, Aug 13, 2004 at 01:19:55PM +0900, kbchoi wrote:
> Hello..
> 
>     I'm using the sample "cpuload" packages in "/ecos/packages/services".
> cyg_cpuload_calibrate( ) which is in the first part of test program is using idle thread.
> As I know in "idle thread", the value of idle_thread_loops is increasing continuously.
> Because I want to know the action of idle thread, I modified the cyg_cpuload_calibrate( ) as following.
> 
> cyg_cpuload_calibrate(cyg_uint32  *calibration)
> {
>    cyg_handle_t counter;
>    cyg_alarm alarm_s;
>    cyg_handle_t alarmH;
>    cyg_handle_t idleH;
>    cyg_uint32 idle_loops_start;
>    cyg_priority_t old_priority, cur_priority;
>    int   i,j;
> 
>    cyg_thread_create(1,
>        idle_thread_main,
>        0,
>        "Calibration idle thread",
>        idle_stack,
>        sizeof(idle_stack),
>        &idleH,
>        &thread);
> 
>    xc_printf("cyg_cpuload_calibrate #1 : idle_thread_loops = %x \n", idle_thread_loops);
>    for (i = 0 ; i < 100000 ; i++)
>       j = i;	// useless work..
>    xc_printf("cyg_cpuload_calibrate #1 : idle_thread_loops = %x \n", idle_thread_loops);
>    cyg_thread_delay(100);
>    xc_printf("cyg_cpuload_calibrate #1 : idle_thread_loops = %x \n", idle_thread_loops);
> }
> 
> And the result of this code is following.
> 
> 	cyg_cpuload_calibrate #1 : idle_thread_loops = 0
> 	cyg_cpuload_calibrate #2 : idle_thread_loops = 0
> 	cyg_cpuload_calibrate #3 : idle_thread_loops = 512bc
> 
> Then is idle thread working without cyg_thread_resume( ) ?

Remember this is a real idle thread in the system and that one is
started automatically. Its that idle thread that is incrementing the
loop counter.

        Andrew


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]