- http://www.mathworks.com/help/techdoc/ref/cputime.html
- http://blogs.mathworks.com/loren/2006/07/12/what-are-you-really-measuring/
- http://www.mathworks.com/matlabcentral/newsreader/view_thread/296850
- http://newsgroups.derkeiler.com/Archive/Comp/comp.soft-sys.matlab/2005-08/msg00874.html
- http://www.mathkb.com/Uwe/Forum.aspx/matlab/40003/Difference-cputime-tic-toc
cputime seems to count serial computation time, while tic-toc does not
조회 수: 7 (최근 30일)
이전 댓글 표시
The codes below will show the difference. But why? Does that mean, cputime calculates the time for serial computation and tic--toc for parallel or SPMD(Single Process, Multiple Data)? When using SPMD, is the computation in parallel? And if you can use "top" in your server to monitor the cpu usage, you will see usage is more than 100%, that means you are using more than 1 cpu to calculate. Mine cpu usage was 1147%.
clc;
clear;
tic
t=cputime;
N=4000;
all=magic(N);
b=all*all*all*all*all*all*all;
cpu_time=cputime-t
toc_time=toc
============================
My running result is:
cpu_time =
167.3800
toc_time =
14.8073
Because the cpu usage is 1147% for me, so toc_time*1147% is almost the cpu_time result. So I think the cputime calculates the serial computation time.
댓글 수: 0
답변 (1개)
Jan
2011년 5월 3일
See also:
댓글 수: 2
Matt Fig
2011년 5월 3일
That conclusion apparently doesn't follow from your single premise...
Could you flesh out your reasoning a bit more?
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!