getrusage vs clock

paul zimmermann Paul.Zimmermann at inria.fr
Thu Jan 21 13:02:39 UTC 2016


>   since version 2.18 of the glibc, the clock() function is much more precise.
>   For example on my machine it has a resolution of 1 micro-seconds whereas
>   getrusage() has a resolution of 4ms only, as demonstrated by the program
>   below:
>   
> I believe we already use clock_gettime(2) directly on GNU/Linux, which
> is the underlying syscall that clock(3) uses in newer GNU libc versions.
> 
> Does that not happen in your tests?

I don't know how to check which function is used. With gmp-6.1.0 on my
workstation I get:

zimmerma at tomate:/tmp/gmp-6.1.0/tune$ ./speed
...
CPU cycle counter, supplemented by microsecond getrusage()
Gnuplot home page http://www.gnuplot.info/
Quickplot home page http://quickplot.sourceforge.net/

which lets me think that getrusage() is still used.

Paul



More information about the gmp-devel mailing list