profile - Code execution profile and stack usage information

Syntax

profile(vd,'execution','report')
profile(vd,'stack',action)

Description

profile(vd,'execution','report') returns execution profile measurements from the generated code. The report input argument is required. When you select the Profile real-time execution option in the configuration parameters for your model, and then build and run your model on a processor, this function accesses the report of the process execution.

To use profile to assess how your program executes in real-time, complete the following tasks with a Simulink model:

  1. Enable real-time execution profiling in the configuration parameters and build your model.

  2. Select whether to profile by task or subsystem.

  3. Build your model.

  4. Download your program to the processor.

  5. Run the program on the processor.

  6. Stop the running program.

  7. Use profile at the MATLAB command prompt to access the profiling reports.

The HTML report contains the sections described in the following table.

Section HeadingDescription
Worst case task turnaround timesMaximum task turnaround time for each task since model execution started.
Maximum number of concurrent overruns for each taskMaximum number of concurrent task overruns since model execution started.
Analysis of profiling data recorded over nnn seconds.Profiling data was recorded over nnn seconds. The recorded data for task turnaround times and task execution times is presented in the table below this heading.

Task turnaround time is the elapsed time between starting and finishing the task. If the task is not preempted, task turnaround time equals the task execution time.

Task execution time is the time between task start and finish when the task is actually running. It does not include time during which the task may have been preempted by another task.

The execution time calculations do not account for processor time consumed by the scheduler while switching tasks. In cases where preemption occurs, the reported task execution times overestimate the true task execution time.

Task overruns occur when a timer task does not complete before the same task is scheduled to run again. Depending on how you configure the real-time scheduler, a task overrun may be handled as a real-time failure. Alternatively, you might allow a small number of task overruns to accommodate cases where a task occasionally takes longer than normal to complete. If a task overrun occurs, and the same task is scheduled to run again before the first overrun has been cleared, concurrent task overruns are said to have occurred.

Here is a sample of the HTML profiling report—task execution profile report.

profile(vd,'stack',action) returns the CPU stack usage from your application. action defines the stack profiling operation and accepts one of the strings in the following table:

action StringDescription
setupInitializes the CPU stack with a known pattern—0xA5 on all processors.
reportReturns the report of the stack usage from running your application.

You cannot assign the stack profile report to an output variable. The MATLAB structure output from profiling the system stack has the elements described in the following table.

Report EntryUnits Description
System StackMinimum Addressable Unit (MAU)Maximum number of MAUs used and the total MAUs allocated for the stack.
nameString for the stack nameLists the name assigned to the stack.
startAddressDecimal address and pageLists the address of the stack start and the memory page.
endAddressDecimal address and pageLists the address of the end of the stack and the memory page.
stackSizeAddressesReports number of address locations, in MAUs, allocated for the stack.
growthDirectionNot applicableReports whether the stack grows from the lower address to the higher address (ascending) or from higher to lower (descending).

To use profile to assess how your program uses the stack, complete the following tasks with a Simulink model or manually written code:

  1. Build your model with real-time execution profiling enabled in the configuration parameters. Skip this step for custom code.

  2. Download your program to the processor.

  3. Run the program on the processor.

  4. Stop the running program.

  5. Use profile at the MATLAB command prompt to access the profiling reports.

You cannot assign the stack profile report to an output variable. For more information about using stack profiling, refer to System Stack Profiling.

See Also

load

run

  


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