주요 콘텐츠

이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.

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에 개발됨