Using custom code to measure execution time of Simulink subsystems

조회 수: 5 (최근 30일)
Bhargav Kinnal
Bhargav Kinnal 2019년 5월 6일
I need to measure the execution time of a subsystem (group of Simulink blocks) which runs as an atomic unit with a specific sampleTime. The measurement will be done on a Real-time embedded target hardware by flashing code generated by Simulink coder.
I am planning to use the custom code block in Simulink coder to add counters to the generated code. By using specific code at entry and exit of the generated code for subsystem, I plan to count number of clock cycles taken to execute the subsystem.
dSpace RTI library has clock counters like
/* Start time measurement.*/
RTLIB_TIC_START();
/*code*/
/* Read the elapsed time period. */
subsystem_exec_time_1 = RTLIB_TIC_READ();
However, I am not sure if I have dSpace libraries at my disposal. My question is how do I write a counter or a function to log elapsed real-time or count number of clock cycles taken for execution? Is there a way that simulink enables such measurements?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by