Hi Adi,

Adi Sudewa wrote:
> 
> Hi,
> 
> Suppose I have this procedure :
> 
>         void do_it()
>         {
>                 complex_calculation();
>                 other_complex_calculation();
>         }
> 
> and this highest priority rtl thread(ignore syntax errors):
> 
>         pthread_make_periodic(PERIOD);
>         while (1) {
>                 do_it();
>                 pthread_wait();
>         }
> 
> And my questions :
> (1) I assume if execution time do_it() is greater than PERIOD,
>    then all the CPU time will be used by this thread and no other
>    task have chance to run. Is it correct ?

Correct, and if persistent will hang and reboot the system.

> (2) How to measure the worst-case execution time of do_it() ?
>    Can I just run it 100 times, do measurement,  and pick the greatest
> value ?
>

Set the period to be much longer than expected (so you won't lock-up). 
Take the time before and after do_it() and then calculate the worst
case.  This can then be output with printk (every once in a while).  If
you then run it, you can load the system and observe the results.  To
know whether you got the absolute worst case is difficult, but you
should get a close idea of it from this test.

There are examples similiar to this in the RT distributions.

Regards, Stuart
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to