Using custom code to measure execution time of Simulink subsystems
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!