Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate a RTOS task's time

I have written a code in c for Arm7 using RTOS. There are multiple tasks who's priority is set to same level. So the tasks executes on round-robin base.

There is an exception that one task (Default) has set to lower priority then the other task in rtos. So that if no task is running, the default or lower priority task runs.

Now i want to calculate the exact total timing (time duration) for that default task runs.

Can any one give some idea what to do .... and how to do in code..

Regards Dani

like image 924
Adnan Avatar asked Jan 22 '23 23:01

Adnan


1 Answers

A very simple way to see when the default or idle task is running is to make this task toggle an unused (but accessible) GPIO pin or an indicator LED, if your hardware has such a thing. Then if you connect an oscilloscope to the I/O line you can see how long the processor remains in the idle task by the duration of the oscillation period seen on the 'scope. The line will remain in a steady state whenever the other tasks are running.

An alternative method, if you can get to the OS code, is to make the line go high whenever the default task is selected and low for any other task.

like image 164
uɐɪ Avatar answered Feb 05 '23 17:02

uɐɪ