GMPbench

Torbjorn Granlund tege@swox.com
03 Dec 2002 16:07:49 +0100


--=-=-=

Jason Moxham <J.L.Moxham@maths.soton.ac.uk> writes:

  what is timing.h in the code ?
  
And you need cputime.c as well.  (This is in some GMP tests
functions too.)


--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=cputime.c

/* Return user CPU time measured in milliseconds.  */

#if !defined (__sun) \
    && (defined (USG) || defined (__SVR4) || defined (_UNICOS) \
	|| defined (__hpux))
#include <time.h>

int
cputime ()
{
  return (int) ((double) clock () * 1000 / CLOCKS_PER_SEC);
}
#else
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>

int
cputime ()
{
  struct rusage rus;

  getrusage (0, &rus);
  return rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000;
}
#endif

--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


-- 
Torbjörn

--=-=-=--