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;
输入参数
NthSectionProfile
— coder.profile.ExecutionTimeSection
对象
由 coder.profile.ExecutionTime
属性 Sections
生成的对象。
输出参数
SimTime
— 仿真时间
双精度
代码节的仿真时间,以秒为单位。以向量形式返回。
版本历史记录
在 R2013a 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)