Measuring code execution time on MPC5554

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

Measuring code execution time on MPC5554

959 次查看
dranne
Contributor I

Hi

 

I want to measure the execution time of code on MPC5554. What is the most accurate method to do this. Any sample code would be highly appreciated.

 

Thanks

dranne

0 项奖励
回复
1 回复

526 次查看
wg0z
Contributor II

given the absence of interrupts, a certainty that the time base is enabled, a certainty that the timebase is going to stay enabled, and an assumption that there is no overflow of TBL, or that in any case you know how to make sure TBU/TBL are read in a consistent manner:

 

read the time base registers at the start of the code block, perhaps into a U64 called start_time

execute the code block

read the time regbase registers agin, into a U64 called finish_time

 

actual code execution time = (finish_time - start-time) / system_clock_freq - overhead_time

overhead time is the time you lose if the code block is <nothing> 

 

 

 

0 项奖励
回复