Hi

when i use clock() function i only get multiples of 10000, is that normal? I need to find number of clocks taken by a program but i need exact number.

I am using opensuse linux

Any idea??

Printable View

- 10-24-2012Devoxclock function return multiples of 10000 only !!!
Hi

when i use clock() function i only get multiples of 10000, is that normal? I need to find number of clocks taken by a program but i need exact number.

I am using opensuse linux

Any idea?? - 10-24-2012qny
Try gettimeofday() or clock_gettime() instead.

- 10-24-2012dmh2000
per the Linux man page on clock(): C89, C99, POSIX.1-2001. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.

this vlaue it is not the CPU clock rate. it is based on the cpu clock interrupt tick rate. so if you get multiples of 10000, and CLOCKS_PER_SEC == 1000000, the resolution is 10000/1000000 = 10 milliseconds