This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Execution Profiling for Real-Time Applications

You can profile the task execution time and function execution time of your real-time application running on the target computer. Using that information, you can then tune its performance.

Profiling is especially useful if the real-time application is configured to take advantage of multicore processors on the target computer. To profile the real-time application:

  1. In the Configuration Parameters for the model, enable the collection of profile data during execution.

  2. Build, download, and execute the model.

  3. Call profile_slrt to collect and display the profile data.

Profiling slightly increases the execution time of the real-time application.

Configure Real-Time Application for Profiling

This example shows how to configure model dxpcmds6t for task execution profiling.

  1. Open model dxpcmds6t.

  2. In the top model, open the Configuration Parameters dialog box, and select Code Generation > Verification.

  3. Select the Measure task execution time check box.

    Task execution time (TET) measures how long it takes the kernel to run for one base-rate time step. For a multirate model, use the profiler to find out what the execution time is for each rate.

  4. If you also want to profile function execution times, select the Measure function execution times check box.

  5. Under Code Generation, select Simulink Real-Time Options.

  6. Type a value for Number of profiling events (each uses 20 bytes).

    By default, the software logs 5000 events for profiling. You can increase or decrease this number to manage memory usage. When the software logs the specified number of events or the model stops, the software stops collecting the data. The software writes the data to current_working_folder\xPCTrace.csv on the target computer.

  7. Click OK.

  8. Save model dxpcmds6t.

Generate Real-Time Application Execution Profile

This example shows how to generate profile data for model dxpcmds6t using default settings on a multicore target computer.

This procedure assumes that you have configured the target computer to take advantage of multiple cores. It also assumes that you previously configured the model for task and function execution profiling.

Build and download the model.

mdl = 'dxpcmds6t';

When you include profiling, the Code Generation Report is generated by default. It contains links to the generated C code and include files. By clicking these links, you can examine the generated code and interpret the Code Execution Profile Report.

Execute the real-time application.

tg = slrt;

Profile the real-time application execution.

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

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 displays model execution profile results for each task.

Profile DataDescription
Maximum turnaround time Longest time between start and end of code section, which includes preemption time.
Average turnaround timeAverage time between start and end of code section, which includes preemption time.
Maximum execution timeLongest time between start and end of code section, which excludes preemption time.
Average execution timeAverage time between start and end of code section, which excludes preemption time.
CallsNumber of calls to the code section.

To display the profile data for the generated code section, click the Membrane button   in the Coder Execution Profiling Report.

Close the model.


See Also

Related Topics

Was this topic helpful?