6 years, 9 months ago.

[RTOS] Measure cpu idle time?

Hi!

I want to test, check and verify some code running in RTOS and need:

1) the time, an algorithm needs for some work. 2) the percentage of time spent to this thread.

1) could be easily done using the Timer class, but only downto microseconds. For nanoseconds I can scale it to microseconds, using loops.

But what about 2) ? It would be enough to measure the idle time. But how to?

Is there a built-in or standard profiling system?

1 Answer

6 years, 9 months ago.

I think there is no built-in or standard profiling system. If you have a scope, you can add two lines of code to the scheduler to switch on/off a port pin if enter the idle task. With the scope you can monitor this signal down to nanoseconds.