Main Content

Specify Hardware Timer

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 theCode Replacement Toolor the code replacement library API to specify this hardware-specific timer.

To specify the timer with the Code Replacement Tool:

  1. Open the Code Replacement Tool. In the Command Window, entercrtool.

  2. Create a new code replacement table. SelectFile>New table.

  3. Create a new function entry. UnderTables List, right-click the new table. Then, from the context-menu, selectNew entry>Function.

  4. In the middle view, select the new unnamed function.

  5. On theMapping Informationpane:

    1. From theFunctiondrop-down list, selectcode_profile_read_timer.

    2. Specify the count direction for your timer. For example, from theCount directiondrop-down list, selectUp.

    3. In theTicks per secondfield, 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.

    4. In theConceptual functionsection, from theData typelist, selectuint8,uint16,uint32, oruint64.

    5. In theFunction prototypesection, in theName字段中,指定一个替代函数名,前女友ample,MyTimer.

    6. ClickApply.

    7. To validate the function entry, clickValidate entry.

  6. On theBuild Informationpane, specify the required build information. See Specify build information inDefine Code Replacement Library Optimizations.

  7. Save the table (Ctrl+S). 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 ofrtw.connectivity.Config.

    The software stores your timer information as a code replacement library table.

  8. Assuming you save the table asMyCrlTable.m, in your subclass ofrtw.connectivity.Config, add the following line:

    setTimer(this,MyCrlTable)

Related Examples

More About