Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

IppGetCpuClocks giving unstable values.

Ashwin_S_
Beginner
318 Views
I tried Ipp64u before,after; int count; for(count=0;count<10;count++) { before=IppGetCpuClocks(); after=IppGetCpuClocks(); printf("Total no. of clocks used in between : %f",(double)(after-before)); } though there is nothing in between before and after still the values I am getting is not stable it returns different values . Why is it so ? I want to measure value of no. of clocks used for xyz function using Ipp64u before,after; before=IppGetCpuClocks(); xyz(); after=IppGetCpuClocks(); printf("Total no. of clocks used in between : %f",(double)(after-before)); So How to get it ?
0 Kudos
2 Replies
Roman_T_
New Contributor I
318 Views

Hi Ashwin,

What operating system do you use? If MS Windows, Windows is not a Real Time Operating System. Every time a lot of threads work in your computer at the same time. And your CPU has no more than 8 cores (for Intel Core i7).
So, OS performs time quantization for all threads on your PC. As a result, time to complete operation will be slightly different in any case.
One of possible solutions is to repeat measure process many times, and get  average.

Best regards,
Roman

 

0 Kudos
Sergey_K_Intel
Employee
318 Views

Ashwin,

ippGetCpuCLocks functions returns readings of RTC - real-time counter. It's is analog of wall clock.
It cannot be slower or faster, it just ticks)). The difference between two readings shows the amount of time spent between "before" and "after".
How fast you get from "before" to "after" depends on what Roman is writing about.

0 Kudos
Reply