63 #define BASENUM 1000000
65 #define PROG bnspeed_main
74 #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
82 #include <sys/types.h>
83 #include <sys/times.h>
90 #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
95 #include <sys/timeb.h>
98 #if defined(sun) || defined(__ultrix)
101 #include <sys/param.h>
110 # ifndef _BSD_CLK_TCK_
113 # define HZ ((double)_BSD_CLK_TCK_)
116 # define HZ ((double)CLK_TCK)
121 #define BUFSIZE ((long)1024*8)
124 static double Time_F(
int s);
128 static double Time_F(
int s)
132 static struct tms tstart,tend;
142 ret=((double)(tend.tms_utime-tstart.tms_utime))/
HZ;
143 return((ret < 1
e-3)?1
e-3:ret);
146 static struct timeb tstart,tend;
157 i=(long)tend.millitm-(
long)tstart.millitm;
158 ret=((double)(tend.time-tstart.time))+((
double)i)/1000.0;
159 return((ret < 0.001)?0.001:ret);
165 static int sizes[
NUM_SIZES]={128,256,512,1024,2048};
170 int main(
int argc,
char **argv)
198 for (k=0; k<
num; k++)
201 printf(
"mul %4d x %4d -> %8.3fms\n",sizes[i],sizes[j],tm*1000.0/num);
211 for (k=0; k<
num; k++)
214 printf(
"sqr %4d x %4d -> %8.3fms\n",sizes[i],sizes[i],tm*1000.0/num);
226 for (k=0; k<100000; k++)
227 BN_div(r, NULL, b, a,ctx);
229 printf(
"div %4d / %4d -> %8.3fms\n",sizes[j],sizes[i]-1,tm*1000.0/num);