主要内容

Profiling and Tracing for Performance Optimization

Optimize execution and resource usage by using the execution profiler and tracer

Real-time applications running on target computers must meet strict timing and reliability requirements. To ensure optimal performance and correct execution flow, profiling and tracing are two essential techniques:

  • Profiling — measures the execution time of each function in an application and helps you to identify bottlenecks and optimize performance.

  • Tracing — captures the sequence of events and helps analyze execution flow and resource utilization.

Use profiling data to verify timing constraints, examine function call stacks, and optimize application design. Use tracing data to validate execution order, verify CPU usage, tune for multicore execution, and analyze event sequences.

To improve the performance of your real-time application, consider the following changes:

  • Change a single-rate model that is inherently multirate to a multirate model.

  • Use a multicore target computer, and then set the tasking mode to multitasking.

  • Determine the lower limit on sample time that does not produce a CPU overload.

  • Start profiler and tracer for a real-time application, and retrieve the results. Evaluate the results for potential improvements in the task and core distribution of the model.

  • For an inherently single-rate model, execute the real-time application on a multicore target computer with polling mode.

Objects

TargetRepresent real-time application and target computer status
InstrumentCreate real-time instrument object
slrealtime.instrument.LineStyleCreate real-time instrument LineStyle object (Since R2022b)
StimulationTarget computer model root inport stimulator object

Functions

expand all

deleteProfilerDataDelete profiler data from target computer
getAvailableProfileGet list of applications with profiler data available on target computer
getProfilerDataDownload profiler data from target computer
getProfilerStatusGet profiler status on target computer (Since R2026a)
resetProfilerReset profiler on target computer
startProfilerStart profiler on target computer
stopProfilerStop profiler on target computer
deleteTracerDataDelete tracer data from target computer (Since R2026a)
getAvailableTraceGet list of application with tracing information available on target computer (Since R2026a)
getTracerDataDownload tracer data from target computer (Since R2026a)
getTracerStatusGet tracer status on target computer (Since R2026a)
resetTracerReset tracer on target computer (Since R2026a)
startTracerStart tracer on target computer (Since R2026a)
stopTracerStop tracer on target computer (Since R2026a)
deleteCoreFilesDeletes crash stack core files from target computer (Since R2026a)
getCrashStackDownloads and decodes crash stack core files from target computer and opens these in MATLAB editor
getSupportInfoCreates slrealtimeinfo.txt file that provides support information about Simulink Real-Time installation
slrealtime.testSetupRun series of confidence tests that check development-to-target computer communications (Since R2026a)
slrtPerformanceAnalyzerOpen Simulink Real-Time Performance Analyzer (Since R2026a)
slrtTETMonitorOpen Simulink Real-Time task execution time (TET) monitor

Blocks

Log EventLog an execution profiling event

Topics

Featured Examples