Main Content

Profiling Real-Time Applications

R2026b

Profiling measures the execution time and resource usage of tasks, functions, and threads running on a Speedgoat® target computer. Use profiling to:

  • Identify performance bottlenecks in your application.

  • Verify that tasks meet timing constraints.

  • Optimize CPU utilization for multicore execution.

Simulink® Real-Time™ generates profiling data for an application running on the target computer and downloads the data to the host computer as a PERF file. This file contains performance event samples, symbolized function names, and metadata about the system and workload.

Generate Profiler Data

To generate and download profiler data for a real-time application:

  1. Create and deploy a real-time application on the target computer.

  2. Start the profiler.

    startProfiler(tg);

  3. Start the application and tune the parameters as needed.

    startApplication(tg);

  4. Stop the application.

    stop(tg);
    When you stop the application, the profiler also stops. To stop only the profiler while the application continues running, use stopProfiler(tg) instead.

  5. Download the profiler data.

    getProfilerData(tg);

Simulink Real-Time downloads the profiler data and saves the file as profilingData_app_name.perf in the current MATLAB folder, where app_name is the name of the real-time application.

Analyze Profiler Data

The .perf file is in Linux perf format and can be analyzed with standard Linux perf tools. The profiler data file contains performance event samples and metadata from a profiling session. You can use profiler data to:

  • Identify CPU hotspots in applications.

  • Determine which functions or code paths consume the most CPU cycles.

  • Detect lock contention, I/O stalls, and thread scheduling delays.

  • Investigate cache misses, branch mispredictions, and other hardware-level inefficiencies.

  • Understand calling contexts of expensive functions by using recorded call stacks.

  • Verify that tasks meet timing constraints and deadlines.

See Also

| | | | | | | |

Topics