Code Execution Measurement using Profiling Function Block

cancel
Showing results for 
Search instead for 
Did you mean: 

Code Execution Measurement using Profiling Function Block

1,684 Views
sindhujabala
Contributor I

Hi,

I'm trying to measure execution time for the model run in PIL Simulation mode using Profiler function block.

But I'm facing issue in checking the output in Freemaster tool V2.0. I have attached the sample model.

Kindly tell how to fix the issue inorder to check the output with Freemaster tool V2.0

Thanks,

Sindhuja Bala.

Labels (1)
Tags (1)
0 Kudos
7 Replies

964 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi sindhujabala

If you wish to test the Processor-In-The-Loop execution time with the dedicated Profiler Function Simulink Block then you don't have to use the FreeMASTER

pastedImage_3.png

Since PIL is a co-simulation between code that runs on Host PC and the code that runs on the actual HW, you could use the standard Simulink Scope to check the results - how much time the function needs to be executed. 

All you have to do is:

1: add the Profiling function block in your PIL model 

pastedImage_4.png

2: Configure the block to "Show Profile Output"

pastedImage_5.png

Then all you need to do in your harness test is to plot that PIL Profiler output.

pastedImage_6.png

For your particular model the result is shown below:

pastedImage_7.png

Your model contained some mistakes which i have corrected, check the attachement. If you want to learn more about PIL please check this video:  Video Link : 7845 

0 Kudos

964 Views
sindhujabala
Contributor I

Hi,

Thanks for the reply.

Is it possible to get profiling report giving the details of code execution time for each function and number of time function called.

0 Kudos

964 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hello, 

Are you looking for this kind of report?

pastedImage_1.png

For the moment that is not possible on PIL nor actual hardware. That is a function provided by MATLAB but was not yet enabled on existing toolboxes. For the PIL and actual HW application we can only show the actual execution cycles.

Nonetheless, you have a relative simple alternative: You could create subsystem for the functions you need to profile and add in each one a Profile Function. We can profile up to 100 function in a single run by changing the Profiler index.

pastedImage_2.png  

Hope this helps!

Daniel

0 Kudos

964 Views
sindhujabala
Contributor I

Code Execution Profile.PNG

I'm looking for code execution profile report like this.

Profiling_Configuration setting.PNG

For collecting the Profiling data  there is an option in Code generation pane verification tab, Measure task execution time and Measure function execution times checkboxes has to be checked . But I'm getting Model error when simulation done. I have tried with your sample model also.

Herewith attached the error screenshot

Model Simulation Error.PNG

Kindly confirm the reason.

0 Kudos

963 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Sindhuja Bala, 

I did confirm that in the previous reply :-)

For the moment that is not possible on PIL nor actual hardware. 

For PIL/HW targets MATLAB provides an API that needs a HW timer implementation. In this case that API is left empty because we have not implemented yet that functionality. There are multiple issues in that regards especially when the timer overflows. We have done various tests and so far we did not found a reliable method to get timestamps from the real hardware. We are working with MATHWORKS team to find a resolution for such issues and hope we could enable such function in future releases.

Thank you!

Daniel

963 Views
sindhujabala
Contributor I

Hi Daniel,

Thanks for continuous support.

Do let us know if any know if any improvement or fixing done in Real hardware Execution Profiling in future.

We are looking forward to hear.

Thanks& Regards,

Sindhuja Bala

0 Kudos

963 Views
sindhujabala
Contributor I

Hi Daniel,

Thanks for your continuous support and detailed explanation.

0 Kudos