#include <openssl/crypto.h>
#include "perflib/perflib.h"
-#define NUM_CALLS_PER_BLOCK 100
-#define NUM_CALL_BLOCKS_PER_THREAD 100
-#define NUM_CALLS_PER_THREAD (NUM_CALLS_PER_BLOCK * NUM_CALL_BLOCKS_PER_THREAD)
+#define NUM_CALLS_PER_BLOCK 1000
+#define NUM_CALL_BLOCKS_PER_RUN 100
+#define NUM_CALLS_PER_RUN (NUM_CALLS_PER_BLOCK * NUM_CALL_BLOCKS_PER_RUN)
int err = 0;
+static int threadcount;
+
void do_randbytes(size_t num)
{
int i;
unsigned char buf[32];
- for (i = 0; i < NUM_CALLS_PER_THREAD; i++)
+ for (i = 0; i < NUM_CALLS_PER_RUN / threadcount; i++)
if (!RAND_bytes(buf, sizeof(buf)))
err = 1;
}
int main(int argc, char *argv[])
{
- int threadcount;
OSSL_TIME duration;
uint64_t us;
double avcalltime;
us = ossl_time2us(duration);
- avcalltime = (double)us / (NUM_CALL_BLOCKS_PER_THREAD * threadcount);
+ avcalltime = (double)us / NUM_CALL_BLOCKS_PER_RUN;
if (terse)
printf("%lf\n", avcalltime);