How to get pointer to IDLE thread?
Posted: Fri May 11, 2012 7:20 am
Hi Giovanni,
In my project I need to roughly estimate "CPU usage". It can be calculated from Idle ticks and whole system ticks. For this purpose I need to get pointer to Idle thread. Is there elegant way to get Idle thread pointer? I have found 2:
1) Iterate through thread registry and search name "idle". Ugly.
2) Modify chSysInit() function to return idle thread pointer.
Also, I can realize second way and commit to trunk if it acceptable.
In my project I need to roughly estimate "CPU usage". It can be calculated from Idle ticks and whole system ticks. For this purpose I need to get pointer to Idle thread. Is there elegant way to get Idle thread pointer? I have found 2:
1) Iterate through thread registry and search name "idle". Ugly.
2) Modify chSysInit() function to return idle thread pointer.
Also, I can realize second way and commit to trunk if it acceptable.