How is execution time (cpu time) calculated for multi-core cpu?

조회 수: 14 (최근 30일)
Jeff
Jeff 2012년 4월 17일
답변: Philip Borghesani 2016년 9월 23일
1) For multi-core cpu, when I use profile to check the execution time, does profile include the hidden time due to the parallel processing?
2) Also, Matlab recommends using single core for accurate profiling, when I disable other cores and run the program it keeps showing 'not all cpus are enabled'. Does that affect the profile (by adding overhead or something)?
Thanks a lot guys!

답변 (2개)

Anver Hisham
Anver Hisham 2016년 9월 23일
This is not a complete answer to your question. But I believe you can satisfy your requirement simply by using matlab function cputime.
function f1()
t = cputime;
\< ...Your code here ... \>
simulationTime = cputime -t;
end
In the above example, the computed simulationTime doesn't vary with multithreading, ie. you will get almost same simulationTime irrespective of number of threads/cores used by caller/callee functions.

Philip Borghesani
Philip Borghesani 2016년 9월 23일
The matlab profiler lets you select the timing source if you run it manually using the -timer option:
profile on -timer cpu % will give you total process cpu time across all threads.
profile on -timer real % returns result measured against a constant 'wall' clock.
Check with help for profile for other options and information on the defaults they changed with R2015b.
With current versions of MATLAB and available hardware and OSs it is not necessary to pin the MATLAB process to a single thread/core when profiling.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by