Hello,
I wish to measure the CPU utlization for a cortex processor running an RTOS (keil RTX). Without an RTOS, i can measure the idle time to come to some conclusion. But with RTOS, can someone guide me how to measure CPU utlization?
Thanks & Best Regards Vivek
Don't assume that the simulator will do a 100% perfect job of consuming CPU cycles at an identical speed to the real processor.
Vivek,
How are you resetting the counter? Through a second task or an interrupt routine?
If either is true then I think that the increment may not be an atomic function. Thus you may be clearing the value part way through an increment.
For instance, the first task reads the value from memory into a register, second task interrupts and clears the value in memory, first task resumes and increments the value in the register and then finally stores it back in memory. So it is like the second task never cleared the memory.
It you are using an interrupt routine to clear it you will need an atomic increment routine using an SWI, or through disabling the interrupt. If you use two tasks then 2 SWI routines 1 for increment and 1 for clearing.
RTX has SWI routines in its own code I think for much the same reason.
I use an interrupt routine and I mask this interrupt when I increment the counter variable for this reason.
Stuart