
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
"42Bastian Schick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >How about a 'working' flag and two counters?
> >- When in the idle loop, set the flag to 'idle'
> >- When entering any activity, set the flag to 'at work'
> >- Use a timer interrupt at some arbitrary interval.
> >- In the ISR do something like:
> >void TimerIsr(void)
> >{
> > if(working) atwork++;
> > else idling++;
> >}
>
> And how do you know that you are back at work (without modifying the
> scheduler) ?
>
This works well in a monolithic state-engine design. It doesn't work when a
scheduler preemptively interrupts tasks, as the scheduling is (should be)
transparent to the tasks.
Rob
| <-- __Chronological__ --> | <-- __Thread__ --> |