apps/speed.c: limit loop counters to 2^31 in order to avoid overflows
in performance calculations. For the moment there is only one code fast enough to suffer from this: Intel AES-NI engine. PR: 2096
This commit is contained in:
parent
78a533cb93
commit
d582c98d8f
20
apps/speed.c
20
apps/speed.c
@ -277,9 +277,11 @@ static DWORD WINAPI sleepy(VOID *arg)
|
|||||||
|
|
||||||
static double Time_F(int s)
|
static double Time_F(int s)
|
||||||
{
|
{
|
||||||
|
double ret;
|
||||||
|
static HANDLE thr;
|
||||||
|
|
||||||
if (s == START)
|
if (s == START)
|
||||||
{
|
{
|
||||||
HANDLE thr;
|
|
||||||
schlock = 0;
|
schlock = 0;
|
||||||
thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL);
|
thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL);
|
||||||
if (thr==NULL)
|
if (thr==NULL)
|
||||||
@ -288,17 +290,25 @@ static double Time_F(int s)
|
|||||||
BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
|
BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
|
||||||
ExitProcess(ret);
|
ExitProcess(ret);
|
||||||
}
|
}
|
||||||
CloseHandle(thr); /* detach the thread */
|
|
||||||
while (!schlock) Sleep(0); /* scheduler spinlock */
|
while (!schlock) Sleep(0); /* scheduler spinlock */
|
||||||
|
ret = app_tminterval(s,usertime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = app_tminterval(s,usertime);
|
||||||
|
if (run) TerminateThread(thr,0);
|
||||||
|
CloseHandle(thr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return app_tminterval(s,usertime);
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static double Time_F(int s)
|
static double Time_F(int s)
|
||||||
{
|
{
|
||||||
return app_tminterval(s,usertime);
|
double ret = app_tminterval(s,usertime);
|
||||||
|
if (s == STOP) alarm(0);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1454,7 +1464,7 @@ int MAIN(int argc, char **argv)
|
|||||||
# error "You cannot disable DES on systems without SIGALRM."
|
# error "You cannot disable DES on systems without SIGALRM."
|
||||||
#endif /* OPENSSL_NO_DES */
|
#endif /* OPENSSL_NO_DES */
|
||||||
#else
|
#else
|
||||||
#define COND(c) (run)
|
#define COND(c) (run && count<0x7fffffff)
|
||||||
#define COUNT(d) (count)
|
#define COUNT(d) (count)
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
signal(SIGALRM,sig_done);
|
signal(SIGALRM,sig_done);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user