Using custom code to measure execution time of Simulink subsystems
6 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!