Help with the library elapsed_time for the time analysis of function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with the library elapsed_time for the time analysis of function

Jump to solution
1,052 Views
p_decesare
Contributor III

Hi community,

I have a question about the calculation of time of one function. 
I want to have some explanations because I don't understand very well how to perform the time analysis of the functions of my code. I need to know very well the time of execution of my code in order to comprehend the relationship between the frequency of CAN message.

I downloaded the example of S32K142_02_time_measure_01.7z from the website

"https://community.nxp.com/t5/S32K-Knowledge-Base/Measure-the-running-time-of-one-function-on-S32K/ta..."

I want to know what is the unit of measurements of the variabile ARM_CM_DWT_CYCCNT. I need to calculate the time of the functions of my code. If the difference between two executions is equal to 415 and in my code I choose the SlowRunMode (Bus Clock, Core Clock and Sys Clock equal to 48MHz) I should calculate the ratio between 415/(48MHz) for the fact that the Core Clock is equal to 48MHz?

Thank you for your help

Best regards,

Paola

0 Kudos
1 Solution
1,046 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi p_decesare,

Yes. Your calculation is correct.
The unit of measurements of the variabile ARM_CM_DWT_CYCCNT is CORE_CLK cycles.
For example: set a breakpoint at the end of elapsed_time_stop, you will see the CORE_CLK cycles the Code being measured.

elapsed_time current.png

Best Regards,
Robin

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
1,047 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi p_decesare,

Yes. Your calculation is correct.
The unit of measurements of the variabile ARM_CM_DWT_CYCCNT is CORE_CLK cycles.
For example: set a breakpoint at the end of elapsed_time_stop, you will see the CORE_CLK cycles the Code being measured.

elapsed_time current.png

Best Regards,
Robin

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------