profile_slrt

Collect profiling data

Description

example

profData = profile_slrt(profileInfo) collects and displays execution profiling data from a target computer that is running a suitably configured real-time application. By default, it displays an execution profile plot and a code execution profiling report.

Before calling profile_slrt, use the profiler API functions to start and stop the profiler.

In a future release, the profile_slrt function will be removed. Use the profiler API functions to start and stop the profiler and to display the profiler data.

The Execution Profile plot shows the allocation of execution cycles across the four processors, indicated by the colored horizontal bars. The Code Execution Profiling Report lists the model sections. The numbers underneath the bars indicate the processor cores.

The Code Execution Profiling Report displays model execution profile results for each task.

  • To display the profile data for a section of the model, click the Membrane button  next to the section.

  • To display the TET data for the section in the Simulation Data Inspector, click the Plot time series data button .

  • To view the section in Simulink® Editor, click the link next to the Expand Tree button .

  • To view the lines of generated code corresponding to the section, click the Expand Tree button and then click the View Source button .

In the Verification tab of the Code Generation dialog box, the Measure task execution time check box is checked and locked. To profile function execution times, select the Measure function execution times check box.

After setting these options, you must build, download, and run the real-time application before calling profile_slrt.

Examples

collapse all

Profile the concurrent execution model dxpcmds6t on a multicore target computer with function profiling.

Open model dxpcmds6t.

open_system('dxpcmds6t');

In the top model, open the Configuration Parameters. In the Real-Time tab, click Hardware Settings. Select Code Generation > Verification.

Select the Measure function execution times check box.

Build and download the model.

rtwbuild('dxpcmds6t');
tg = slrt('TargetPC1');
load(tg,'dxpcmds6t');

Start the profiler and execute the model for 2 s.

startProfiler(tg);
start(tg);
pause(2);
stop(tg);

The stop execution command also stops the profiler.

Profile the real-time application execution.

profileInfo.modelname = 'dxpcmds6t.slx';
profData = profile_slrt(profileInfo);

For more information about the time line in the execution profile plot, see timeline.

Input Arguments

collapse all

Profile configuration data, consisting of the following fields:

  • 0 — The raw data file xPCTrace.csv is on the target computer. Transfer the file from the target computer to the host.

  • 1 — The raw data file xPCTrace.csv is in the current folder on the development computer.

Data Types: double

The name can include the model file extension.

Data Types: char

  • 0 — Display the execution profile plot on the development computer monitor.

  • 1 — Do not display the execution profile plot on the development computer monitor.

Data Types: double

  • 0 — Display the code execution profiling report on the development computer monitor.

  • 1 — Do not display the code execution profiling report on the development computer monitor.

Data Types: double

Output Arguments

collapse all

Profile results data stored in an object of type coder.profile.ExecutionTime.

Scales the execution-time tick.

Each array item is an object of type coder.profile.ExecutionTimeSection.

Introduced in R2014a