Measurement of actual execution time on Zynq 7000

Hello, I have been looking for a way how to measure actual execution time of a FreeRTOS task or interrupt service routine (ISR) on Zynq 7000 platform.

My first idea was to use the xTaskGetTickCount function call. The problem which I have found is that in case the ISR is executed the interrupts from the SCU timer (which is a FreeRTOS time base on Zynq 7000) are disabled i.e. the “tick counter” is not refreshed which results in wrong measurement.

Second idea which I had was to read the counter register of SCU timer (it is placed at the address 0xF8F00604) directly via the Xil_In32 function call. I have tried that on a task with 250 millisecond execution period but the results are weird.

My question is whether it is ever possible to use the SCU timer for this purposses and if so whether my way is correct? Respectively can anybody recommend me another way how to do that?

You need to carefully balance resolution vs possible duration. The systic would generally be way to slow to determine CPU usage of an ISR. The SCU timer often does’t have enough bits and counts too fast to be usable for long durations.

IF you look at the performance timer code that can be enabled, it often uses the SCU timer scaled down by a factor, and then adds upper bits based on how many times it has overflowed (and that code depend on being called often enough to detect that overflow), this gives better resolution, but still give a reasonable range.

Hi @Steve,

You could consider toggling a GPIO pin with the Zynq, and capturing it with an oscilloscope. This is how I check my execution times. Just need a write to the register to set the pin high at the point you want to start measuring and another write to set it low at the end, at the cost of a couple of CPU cycles.

Hope this helps.

Kind Regards,