Help with the library elapsed_time for the time analysis of function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Help with the library elapsed_time for the time analysis of function

跳至解决方案
1,051 次查看
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 项奖励
1 解答
1,045 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
1,046 次查看
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!
-----------------------------------------------------------------------------------------------------------------------