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
(既定) が生成されます。シミュレーションの終了時に、6 番目のコード セクションのプロファイルを取得します。
sixthSectionProfile = simOut.executionProfile.Sections(6);
コード セクションのシミュレーション時間を表すベクトルを取得します。
simulationTimeVector = sixthSectionProfile.Time;
入力引数
NthSectionProfile
— coder.profile.ExecutionTimeSection
オブジェクト
coder.profile.ExecutionTime
プロパティ Sections
で生成されるオブジェクト。
出力引数
SimTime
— シミュレーション時間
double
コードのセクションのシミュレーション時間 (秒単位)。ベクトルとして返されます。
バージョン履歴
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)