Overview of Execution Profiling

Introducing Execution Profiling

The Target Support Package IC1 product provides a set of utilities for recording, uploading, and analyzing execution profile data for timer-based tasks and asynchronous Interrupt Service Routines (ISRs). With these utilities, you can

To perform execution-profiling analysis on a model, you must perform the following steps:

  1. Place a copy of the appropriate execution profiling block in your model:

  2. Select the Execution profiling option under Real-Time Workshop options in the Configuration Parameters dialog box. See Real-Time Workshop Options for Execution Profiling.

  3. Connect the target processor to your host PC (with a serial or CAN cable).

  4. Build, download, and run the model.

  5. Initiate execution profiling by running the command profile_c166. See below for more information on the profiling command.

Two forms of execution profiling are provided:

  1. The worst-case values for task turnaround times and number of concurrent task overruns since model execution began are updated whenever a previous worst-case value is exceeded.

  2. A snapshot of task and ISR activity may be recorded over a period of time; the length of this period depends on how much memory is reserved to log the data.

The Profiling Command

Use the profiling command as follows:

profile_c166(connection)

Specify your connection as 'can' or 'serial', to collect data via a CAN or serial connection between the target and the host computer. Make sure the model includes the appropriate C166 execution profiling block (CAN or ASC0), to provide an interface between the target-side profiling engine and the host-side computer from which this command is run.

PROFDATA = profile_c166(connection) collects and displays execution profiling data from a C166 target microcontroller that is running a suitably configured application generated by the Target Support Package IC1 product. PROFDATA contains the execution profiling data in the format documented by exprofile_unpack.

The data collected is unpacked then displayed in a summary HTML report and as a MATLAB graphic.

To use the serial connection, the C166 board must be connected via a serial cable to one of the host computer's serial ports. This function defaults to port ASC0 on the C166 and port COM1 on the host computer. If the 'BitRate' argument is not provided, the default of 57600 baud is used.

PROFDATA = PROFILE_C166('serial','SerialPort',serialport)

sets the serial port to the specified serialport, which should be one of COM1, COM2, etc.

Optionally, you can specify the bit rate as follows:

PROFDATA = PROFILE_C166('serial', 'BitRate', bitrate)

This specification sets the bitrate for serial connection to the target. bitrate must be the same as the bit rate specified for the application that is running on the target.

Alternatively, you can set the bitrate for the serial connection to the target automatically as follows:

profdata = profile_c166('serial', 'ModelName', modelname)

This specification automatically sets the bit rate by analyzing modelname and extracting the correct serial connection bit rate setting from the model. modelname should be set to the name of a model which is currently open and running on the target.

To use the CAN connection, you must have suitable CAN hardware installed. If no Application Channel is specified, this function will use the channel 'MATLAB 1'. The bit rate is a property of the Application Channel; to change the bit rate, you must use a different Application Channel, or change the bit rate by running the Vector Informatik configuration utility. To run this utility, make sure that vcanconf.exe is on your System Path, then type vcanconf from a Windows command prompt.

You can specify the Application Channel as follows:

profdata = profile_c166('can', 'CANChannel', canchannel)

canchannel specifies the Vector Informatik CAN Application Channel, and must be of the form 'MATLAB 1', 'MATLAB 2' etc.

Definitions

Task turnaround time is the elapsed time between start and finish of a task. If the task is not preempted, then the task turnaround time is equal to the task execution time.

Task execution time is that part of the time between task start and finish when the task is actually running and not preempted by another task. Note that the task execution time cannot be measured directly, but is inferred from the task start and finish time and the intervening periods during which it was preempted by another task. Note that, in performing these calculations, no account is taken of processor time consumed by the scheduler while switching tasks: this means that, in cases where preemption has occurred, the reported task execution times will overestimate the true values.

Concurrent task overruns occur when a timer task does not complete before that same task is next scheduled to run. Depending on how the real-time scheduler is configured, a task overrun may be handled as a real-time failure. Alternatively, a small number of concurrent task overruns may be allowed to accommodate cases where a task occasionally takes longer than normal to complete.

Execution Profiling Blocks

See the block reference sections:

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS