필터 지우기
필터 지우기

cpu time in matlab

조회 수: 13 (최근 30일)
E
E 2020년 10월 28일
답변: Walter Roberson 2020년 10월 28일
i have used this cpu time function to calculate my code time to compare to another code but every time run the code i found cpu time completely different
0.6 0.8 1.2 0.5
i dont know where the problem or if there is more accute function in matlab
t = cputime;
my algorithm
e = cputime-t

답변 (1개)

Walter Roberson
Walter Roberson 2020년 10월 28일
See timeit()
Note though that timeit() deals with elapsed time rather than cpu time -- but it takes a number of steps to try to reduce inaccuracies in calculation.
If that is not specific enough for your purposes, then use .NET assembly to access the CPU cycle counters.https://www.mathworks.com/matlabcentral/answers/44352-cpu-cycles-count-for-simulink-model#answer_54380
Note: many "large enough" MATLAB operations automatically use multiple cores, and getting the CPU cycle counts will not total the CPU cycles across multiple cores. CPU cycle counts are not nearly as meaningful as one might hope.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by