Execution time is varying every time I run the program using tic toc. Is there any way to solve this?
조회 수: 15 (최근 30일)
이전 댓글 표시
I am running a code. The execution time of it is varying. If it of the order of milli seconds I understand it. But it is varying of the order of decades of milliseconds.
Like sometimes it is showing (in seconds).
0.189348
0.186602
0.110847
0.205987
22.769279
I am using matlab 2021a with all other apps closed.
Each time I am clearing the workspace and closing and opening the desktop app also. I want to know the correct way to find the execution time. How can do it.
댓글 수: 8
답변 (1개)
Shivani Dixit
2022년 8월 25일
Hello,
As per the data provided it seems the tic and toc functions display approximately same values except for times when values exceed the order of 10.
The tic and toc functions returned incorrect results because:
- The standard processor driver presented the wrong information to the Windows QueryPerformance interface about which timer to use.
- In those cases where the CPU independent APIC clock should have been used, the CPU cycle counter was used instead. The CPU cycle counter can be used only if the processor speed does not vary and if all the cores in the multi-core case appear to be synchronized.
As a solution to this issue, I would like to suggest to:
Install the patch for your hardware starting with the corresponding URL shown below. Reboot your system and rerun the required MATLAB file. It should now pass.
1. Athlon processors
There is one patch that can be applied for both Windows XP and
Windows XP64. Look for a title that begins:
----------------------------------
AMD Athlon 64/FX Processor Driver for Windows XP and
Windows Server 2003 Version (x86 and x64 exe)
----------------------------------
The version and date will change for time. The latest should always work.
2. Opteron processors
There is one patch that can be applied for both Windows XP and
Windows XP64. Look for a title that begins:
----------------------------------
MD Opteron Processor with AMD PowerNow Technology Driver
for Windows XP and Windows Server 2003 Version
(x86 and x64 exe)
----------------------------------
The version and date will change for time. The latest should always work.
The AMD patch installs a new processor driver and, in certain cases, modifies the boot.ini file .
참고 항목
카테고리
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!