This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Questions about cpuload package and idle thread.
- From: "kbchoi" <kbchoi at snssol dot co dot kr>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Fri, 13 Aug 2004 13:19:55 +0900
- Subject: [ECOS] Questions about cpuload package and idle thread.
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( ) ?
And If so, why the second value of idle_thread_loops is "0" ?
These are my questions about cpuload package and idle thread.
Please let me know...
Thanks in advance.
KBCHOI