Is it possible to change the 'ClockPrecision' setting of MATLAB's Profiler?

조회 수: 1 (최근 30일)
The default ClockPrecision value is apparently 0.001 seconds. If a function or line takes less time than that, it registers as 0. I'm trying to assess the efficiency of a few different algorithms to compare them, but none of them take long enough to round up to 1 millisecond. I could not find any way to change this, since it isn't one of the options like 'timer' and 'history' according to the documentation page:
However, I did find this page:
which does not describe how to change the setting, but shows a different value (100 nanoseconds) than what I have (1 millisecond). I'm hoping that means it can be changed, but I can't figure out how.
Thanks in advance for any help.

채택된 답변

John D'Errico
John D'Errico 2015년 6월 25일
편집: John D'Errico 2015년 6월 25일
Use timeit instead to test and compare specific code blocks. It does various things to make that test far more accurate than the profiler. Steve Eddins had at written at posted it on the file exchange, but it is now part of MATLAB, so no download is needed at all.
While the profiler is very nice and very useful to identify problems in your code, you need a tool like timeit to truly optimize performance once you know where the problem lies.
  댓글 수: 5
Nathan
Nathan 2015년 6월 26일
Thanks very much for the explanations. I tried them both but they always disagreed. It's good to know a little about what's going on "under the hood."
Walter Roberson
Walter Roberson 2015년 6월 26일
Later versions of MATLAB can do a fair bit more optimization of expressions at the command line, apparently. For many years, commands at the command line and code in scripts were unoptimized.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Philip Borghesani
Philip Borghesani 2015년 6월 26일
The ClockPrecision is based on the timer used, change the profile timer source for a different precision. If you have access to R2015b the processor timer gives the highest precision.
profile -Timer real %

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by