Measuring Execution Time of Simulink Model or part of it

In Real-time applications, a knowledge of the execution time requirement of the code is necessary for many reasons. This guide will help


Updated 7 May 2020

View License

It is occasionally desired to measure how long it takes for a certain embedded code to execute on given target hardware. For example, real-time applications need to execute in a time period that doesn’t exceed the periodic time (program cycle time), otherwise, a timer-over run error is generated. Another reason why we need to know the execution time is to compare the computational load of different algorithms that perform the same task to know their advantage with respect to computational load and execution speed.
For those who use a Model-based approach and specifically use Simulink for programming real-time application and need a simple way to follow, this short guide is given. Because the Simulink coder keeps them relatively apart from generating the code, they may face difficulties in such measurement while those who code directly with C in code composer studio may not face this difficulty!
To avoid loss of generality and make this guide useful, the specific names of the model and of the block (or subsystem) used in this guide whose execution time knowledge is desired will be edited with the red-colored font to highlight them so as to replace them with your specific names when you repeat the example for your own model/block.

Cite As

Usama Mohamed (2023). Measuring Execution Time of Simulink Model or part of it (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes