Profile Task Execution on Processor

The SoC Blockset™ enables you to monitor and record task execution timings and state from a processor by using code and Kernel instrumentation profiling when a model contains a Task Manager block. When you deploy and run the model on an SoC hardware board, the code or Kernel instrumentation profiler streams the execution timing of the tasks managed by the Task Manager block in the model to the host computer.

The Simulation Data Inspector application displays this data in real time. You can also record this task execution data, which you can use with the Task Manager block to play back the task execution in simulation.

Task Profiling of Model Running on Hardware

  1. Open the Simulink® model to profile it.

  2. On the Modeling tab of the Simulink toolstrip, click Model Settings.

  3. In the Configuration Parameters dialog box, select Hardware Implementation from the left page. Then set Hardware board to an SoC Blockset Supported Hardware.

  4. In the Hardware board settings section, expand Task profiling on processor, and select Show in SDI.

  5. Set Instrumentation to Code or Kernel for code or Kernel instrumentation profiling, respectively. Based on the profiling method you select, execution data is collected from the processor and displayed on the Simulation Data Inspector application. You can select Kernel instrumentation only when you have LTTng enabled in the Linux operating system running on your hardware board. For more information about the instrumentation methods, see Kernel Instrumentation Profiler and Code Instrumentation Profiler.

  6. If you select Kernel to specify Kernel profiling, set Profiling Duration to Unlimited or Limited.

    • Unlimited — Performs Kernel profiling on the hardware and streams it to the Host PC for an infinite time duration

      Note

      Kernel profiling for an Unlimited time duration on hardware with low free disk storage or a model with high task rates can result in packet loss of profiling data streamed from the hardware. For more information, see Task Profiling on Processor.

    • Limited — Performs Kernel profiling on the hardware and streams it to Host PC for a limited time duration

      Note

      Kernel profiling for a Limited time duration on hardware does not result in packet loss of profiling data streamed from the hardware. For more information, see Task Profiling on Processor.

  7. Optionally select Save to file to log the measured task execution data into a file and save that file to the <model>_ert_rtw/instrumented/diagnostics folder on your Host PC. You can use this recorded data file with a Task Manager block to simulate the task execution timing on your model.

  8. On the Simulink toolstrip, on System On Chip tab, click Configure, Build & Deploy to deploy and execute the code on the hardware board.

  9. Open the Simulation Data Inspector application, to view the task execution timing for the tasks and processors on which the tasks execute.

You can access and examine the logged data in the code generation folder used by the model. For more information on accessing the recorded streaming profiled data, see Recording Tasks for Use in Simulation. To use the recorded data in simulation, see Task Execution Playback Using Recorded Data.

Note

Profiling, external mode, and data logging use the same communication channel. To prevent data drops and gaps, do not run profiler simulations with external mode or data logging enabled, and vice-versa.

See Also

Related Topics