< OpenECU Support

Application Resource Usage

Overview

OpenECU provides a lot of information to help you determine how your application is using the CPU resources. This information can be found in the following locations:

  • Build output
    • In the Simulink diagnostics window (or in the Matlab Command window for earlier versions of Matlab)
  • In your calibration tool
    • The OpenECU platform automatically creates variables that you can use to view your application performance.


How to determine RAM usage

At the end of the build, RAM usage will be printed to the Simulink diagnostics window.

  • To view, click View Diagnostics on the bottom of your Simulink model window.

    • For older versions of Matlab, the RAM usage information will be printed in the Matlab Command window.

The build information output will look as follows:

### Build information: 
..Strategy memory: 
    184548 bytes of strategy/code memory used 
    339676 bytes remaining 
..Calibration memory: 
      2514 bytes of calibration memory used (rough indication, includes Simulink support data) 
    259629 bytes remaining 
..Workspace memory: 
     25896 bytes of workspace/displayable memory used, including 
         0 bytes of adaptive data, and 
        52 bytes of diagnostic trouble code data, and 
      8192 bytes of model stack 
     39639 bytes remaining

The RAM is listed as Workspace memory. In the above example, the model used 25896 bytes of RAM, and 39639 bytes of RAM remain.


How to determine stack allocation

At the end of the build, stack allocation will be printed to the Simulink diagnostics window.

  • To view, click View Diagnostics on the bottom of your Simulink model window.

    • For older versions of Matlab, the RAM usage information will be printed in the Matlab Command window.

The build information output will look as follows:

### Build information: 
..Strategy memory: 
    184548 bytes of strategy/code memory used 
    339676 bytes remaining 
..Calibration memory: 
      2514 bytes of calibration memory used (rough indication, includes Simulink support data) 
    259629 bytes remaining 
..Workspace memory: 
     25896 bytes of workspace/displayable memory used, including 
         0 bytes of adaptive data, and 
        52 bytes of diagnostic trouble code data, and 
      8192 bytes of model stack 
     39639 bytes remaining

The stack allocation is listed in the Workspace memory area. In the above example, the model allocated 8192 bytes for the stack.

How do I determine how much stack my application is using?

How do I change the stack size in my application?

How can I tell if stack overflow is the cause of my ECU resetting?


How to determine application flash usage

At the end of the build, application flash usage will be printed to the Simulink diagnostics window.

  • To view, click View Diagnostics on the bottom of your Simulink model window.

    • For older versions of Matlab, the application flash usage information will be printed in the Matlab Command window.

The build information output will look as follows:

### Build information: 
..Strategy memory: 
    184548 bytes of strategy/code memory used 
    339676 bytes remaining 
..Calibration memory: 
      2514 bytes of calibration memory used (rough indication, includes Simulink support data) 
    259629 bytes remaining 
..Workspace memory: 
     25896 bytes of workspace/displayable memory used, including 
         0 bytes of adaptive data, and 
        52 bytes of diagnostic trouble code data, and 
      8192 bytes of model stack 
     39639 bytes remaining

The application flash usage is listed as strategy/code memory used. In the above example, the model used 184548 bytes of flash memory for the application, and 339676 bytes of application flash remain.


How to determine calibration flash usage

At the end of the build, calibration flash usage will be printed to the Simulink diagnostics window.

  • To view, click View Diagnostics on the bottom of your Simulink model window.

    • For older versions of Matlab, the calibration flash usage information will be printed in the Matlab Command window.

The build information output will look as follows:

### Build information: 
..Strategy memory: 
    184548 bytes of strategy/code memory used 
    339676 bytes remaining 
..Calibration memory: 
      2514 bytes of calibration memory used (rough indication, includes Simulink support data) 
    259629 bytes remaining 
..Workspace memory: 
     25896 bytes of workspace/displayable memory used, including 
         0 bytes of adaptive data, and 
        52 bytes of diagnostic trouble code data, and 
      8192 bytes of model stack 
     39639 bytes remaining

The calibration flash usage is listed in the Calibration memory section. In the above example, the model used 2514 bytes of flash memory for calibrations, and 259629 bytes of calibration flash remain.


How to determine stack usage

OpenECU includes many variables in the A2L file to help you determine the performance of your ECU. You can view these variables using a CCP calibration tool such as OpenECU Calibrator or ATI Vision.

  • All of these variables begin with the mpl_ prefix.

To view the stack usage, use the following variable:

  • mpl_max_used_stack: this variable gives you maximum stack used since the last ECU reset, in bytes.

Additionally, you can use the Stack Used block to monitor stack usage in your application code.

How do I determine how much stack my application is using?

How do I change the stack size in my application?

How can I tell if stack overflow is the cause of my ECU resetting?


How to determine CPU load

OpenECU includes many variables in the A2L file to help you determine the performance of your ECU. You can view these variables using a CCP calibration tool such as OpenECU Calibrator or ATI Vision.

  • All of these variables begin with the mpl_ prefix.

To view the CPU load, use the following two variables:

  • mpl_cpu_loaded: this variable gives you the instantaneous CPU load, in percent

  • mpl_max_cpu_loaded: this variable gives you the maximum CPU load since the last ECU reset, in percent


How to determine how much time each task is using

OpenECU includes many variables in the A2L file to help you determine the performance of your ECU. You can view these variables using a CCP calibration tool such as OpenECU Calibrator or ATI Vision.

  • All of these variables begin with the mpl_ prefix.

To view the instantaneous time that a task is taking, the variable name will be:

  • mpl_tt_(taskname), where (taskname) is replaced by the task name that you are interested in.

    • The task time will be shown in the calibration tool in microseconds.

Example:

  • mpl_tt_task_10ms will display the 10ms task in your Simulink model.

To view the maximum time that a task has used since the last ECU reset, the variable name will be:

  • mpl_mtt_(taskname), where (taskname) is replaced by the task name that you are interested in.

    • The task time will be shown in the calibration tool in microseconds.

Example:

  • mpl_mtt_task_10ms will display the maximum time used by the 10ms task in your Simulink model.

Additionally, you can use the Task Duration block to monitor stack usage in your application code.


How to determine if a task is close to overrunning

See How to determine how much time each task is using, and read the information regarding the maximum time that a task has used since the last reset (i.e. the mpl_mtt_ variables).

  • Compare the maximum task time in the mpl_mtt_ variable to the allotted time for that task.

    • If the maximum time used is close to the allotted time, your task is close to overrunning.

Example:

  • mpl_mtt_task_10ms is showing 9526 microseconds. This is very close to the allotted 10ms task time (which is 10000 microseconds).

Copyright © 2022 OpenECU, All rights reserved