version 1.1.1.1, 2000/01/10 15:35:26 |
version 1.1.1.2, 2000/09/09 14:12:45 |
|
|
|
/* |
|
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. |
|
|
|
This file is part of the GNU MP Library. |
|
|
|
The GNU MP Library is free software; you can redistribute it and/or modify |
|
it under the terms of the GNU Lesser General Public License as published by |
|
the Free Software Foundation; either version 2.1 of the License, or (at your |
|
option) any later version. |
|
|
|
The GNU MP Library is distributed in the hope that it will be useful, but |
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
|
License for more details. |
|
|
|
You should have received a copy of the GNU Lesser General Public License |
|
along with the GNU MP Library; see the file COPYING.LIB. If not, write to |
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
|
MA 02111-1307, USA. |
|
*/ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include "gmp.h" |
#include "gmp.h" |
#include "gmp-impl.h" |
#include "gmp-impl.h" |
#include "longlong.h" |
|
|
|
#ifndef USG |
#if defined (USG) || defined (__SVR4) || defined (_UNICOS) || defined (__hpux) |
#include <sys/time.h> |
#include <time.h> |
#include <sys/resource.h> |
|
|
|
unsigned long |
int |
cputime () |
cputime () |
{ |
{ |
struct rusage rus; |
if (CLOCKS_PER_SEC < 100000) |
|
return clock () * 1000 / CLOCKS_PER_SEC; |
getrusage (0, &rus); |
return clock () / (CLOCKS_PER_SEC / 1000); |
return rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000; |
|
} |
} |
#else |
#else |
#include <time.h> |
#include <sys/types.h> |
|
#include <sys/time.h> |
|
#include <sys/resource.h> |
|
|
#ifndef CLOCKS_PER_SEC |
int |
#define CLOCKS_PER_SEC 1000000 |
|
#endif |
|
|
|
#if CLOCKS_PER_SEC >= 10000 |
|
#define CLOCK_TO_MILLISEC(cl) ((cl) / (CLOCKS_PER_SEC / 1000)) |
|
#else |
|
#define CLOCK_TO_MILLISEC(cl) ((cl) * 1000 / CLOCKS_PER_SEC) |
|
#endif |
|
|
|
unsigned long |
|
cputime () |
cputime () |
{ |
{ |
return CLOCK_TO_MILLISEC (clock ()); |
struct rusage rus; |
|
|
|
getrusage (0, &rus); |
|
return rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000; |
} |
} |
#endif |
#endif |
|
|
|
|
#if defined (__m88k__) |
#if defined (__m88k__) |
#define CLOCK 20 M |
#define CLOCK 20 M |
#elif defined (__i386__) |
#elif defined (__i386__) |
#define CLOCK (16.666667 M) |
#define CLOCK (16666667) |
#elif defined (__m68k__) |
#elif defined (__m68k__) |
#define CLOCK (20 M) |
#define CLOCK (20 M) |
#elif defined (_IBMR2) |
#elif defined (_IBMR2) |
|
|
main () |
main () |
{ |
{ |
mp_limb_t nptr[2 * SIZE]; |
mp_limb_t nptr[2 * SIZE]; |
mp_limb_t dptr[SIZE]; |
mp_limb_t dptr[2 * SIZE]; |
mp_limb_t qptr[2 * SIZE]; |
mp_limb_t qptr[2 * SIZE]; |
mp_limb_t pptr[2 * SIZE]; |
mp_limb_t pptr[2 * SIZE + 1]; |
mp_limb_t rptr[2 * SIZE]; |
mp_limb_t rptr[2 * SIZE]; |
mp_size_t nsize, dsize, qsize, rsize, psize; |
mp_size_t nsize, dsize, qsize, rsize, psize; |
int test; |
int test; |
|
|
|
|
for (test = 0; ; test++) |
for (test = 0; ; test++) |
{ |
{ |
|
printf ("%d\n", test); |
#ifdef RANDOM |
#ifdef RANDOM |
nsize = random () % (2 * SIZE) + 1; |
nsize = random () % (2 * SIZE) + 1; |
dsize = random () % nsize + 1; |
dsize = random () % nsize + 1; |