Hello @rathi_tg,
I had a look at your models.
Profiler. The reason for the compile error was that the Measure task execution time option in Simulink settings was checked. This option is used for the PIL and does not work on standalone models. On standalone models, the profiler block works independently of Matlab environment. Basically, the block uses a timer counter value. It stores the timer at the beginning of the function/atomic subsystem where it is placed and stores the counter value just before exiting from that function. By subtracting those values, you get in TICKS the duration.

In our case, I've added the Profiler block and selected Index:0. This index is very important because it stores the value inside a variable called profile_buffer[index] which can be accessed from FreeMaster (more details here https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-do-I-use-the-Profiler-Function-correct...
I've added a FreeMaster project and got the execution time about 21 ticks, which means 1.01 uS.

With a logic analyzer, we can see that the step function (when the led is toggled) is called every millisecond, as expected, because the step function, takes less than 1millisecond.

CAn_test
For this example, I did the exact same thing. I have divided the main model into 3 parts. LED, FUNCTION, and CAN with the mention that I have connected nothing to the CAN output pins, so the measured "transfer" subsystem is not accurate at all.

You can see that the Matlab functions code takes 2.8 milliseconds. The model time is 1 ms, so the PIT triggers the step, waits 2.8 milliseconds until the step function is completed, clears the PIT flags and after 3 ms from the step call another step function is executed. Same, 3ms are measured using the logic analyzer.

To make a subsystem eligible for the profiling block, once you create the subsystem that you want to measure, please right-click on it > Block Paramters > Check "Treat as atomic unit" and make it as "Nonreusable function". It also works with "Reusable function" too.


Please find the attached models and the attached freeMaster project.
Hope this helps,
Marius