Specify Hardware Timer for Simulink
For processor-in-the-loop (PIL) code execution profiling, you must create a timer object that provides details of the hardware-specific timer and associated source files. You can use the Code Replacement Tool or the code replacement library API to specify this hardware-specific timer.
To specify the timer with the Code Replacement Tool:
- Open the Code Replacement Tool. In the Command Window, enter - crtool.
- Create a new code replacement table. Select New > Table. 
- Create a new function entry. On the left pane, click the new table. Then, from the toolstrip, select New > Entry > Function Entry. 
- In the middle view, select the new unnamed function. 
- On the right pane: - From the Function drop-down list, select - code_profile_read_timer.
- Specify the count direction for your timer. For example, from the Count direction drop-down list, select - Up.
- In the Ticks per second field, specify the number of ticks per second for your timer, for example, - 1e+09.- The default value is 0. In this case, the software reports time measurements in terms of ticks, not seconds. 
- In the Conceptual function section, from the Data type list, select - uint8,- uint16,- uint32, or- uint64.
- In the Function prototype section, in the Name field, specify a replacement function name, for example, - MyTimer.
- Click Apply.  
- To validate the function entry, click Validate entry. 
 
- On the Build Information pane, specify the required build information. See Specify build information in Define Code Replacement Library Optimizations. 
- Save the table by clicking Save. When you save the table for the first time, use the Save As dialog box to specify the file name and location. - You must save the table in a location that is on the MATLAB® search path. For example, you can save this file in the folder for your subclass of - rtw.connectivity.Config.- The software stores your timer information as a code replacement library table. 
- Assuming you save the table as - MyCrlTable.m- rtw.connectivity.Config, add the following line:- setTimer(this, MyCrlTable)