Time
获取代码节的仿真时间
说明
返回仿真时间向量,该向量对应于代码节的执行时间测量值。SimTime
= NthSectionProfile
.Time
示例
如果您有可以运行基于 SIL、PIL 或 XCP 的外部模式仿真的模型 myModel.slx
,您可以配置该模型以生成包含执行时间测量值的工作区变量。
set_param('myModel', 'CodeExecutionProfiling', 'on'); set_param('myModel', 'CodeProfilingInstrumentation', 'detailed'); set_param('myModel', 'CodeProfilingSaveOptions', 'AllData');
sim('myModel')
命令时,仿真会生成变量 executionProfile
(默认值)。在仿真结束时,获得一个代码节的探查信息。例如:seventhSectionProfile = executionProfile.Sections(7);
simulationTimeVector = seventhSectionProfile.Time;
在此示例中,运行 SIL 模式仿真,其中模型生成包含执行时间测量值的工作区变量。
openExample('ecoder/SILPILVerificationExample', ... supportingFile='SILTopModel.slx') % Disable Simulink Code Coverage and third-party code coverage analysis set_param('SILTopModel',... 'CovEnable', 'off'); covSettings = get_param('SILTopModel', 'CodeCoverageSettings'); covSettings.CoverageTool = 'None'; set_param('SILTopModel', 'CodeCoverageSettings', covSettings); % Configure code execution time profiling set_param('SILTopModel',... 'CodeExecutionProfiling', 'on'); set_param('SILTopModel',... 'CodeProfilingInstrumentation', 'detailed'); set_param('SILTopModel',... 'CodeProfilingSaveOptions', 'AllData'); simOut = sim('SILTopModel');
simOut
中生成变量 executionProfile
(默认值)。在仿真结束时,获得第六个代码节的探查信息。
sixthSectionProfile = simOut.executionProfile.Sections(6);
获取表示该代码节的仿真时间的向量。
simulationTimeVector = sixthSectionProfile.Time;
输入参数
由 coder.profile.ExecutionTime
属性 Sections
生成的对象。
输出参量
代码节的仿真时间,以秒为单位。以向量形式返回。
版本历史记录
在 R2013a 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)