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;
入力引数
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)