forked from wolfSSL/wolfssl
fixed current_time argument
This commit is contained in:
@@ -150,7 +150,7 @@ static void ShowVersions(void)
|
||||
printf("3\n");
|
||||
}
|
||||
|
||||
extern double current_time(void);
|
||||
extern double current_time(int);
|
||||
|
||||
int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
int doDTLS, int benchmark, int resumeSession)
|
||||
@@ -168,7 +168,7 @@ int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#ifndef NO_SESSION_CACHE
|
||||
int benchResume = resumeSession && loops == 0;
|
||||
#endif
|
||||
double start = current_time(), avg;
|
||||
double start = current_time(1), avg;
|
||||
|
||||
for (i = 0; i < times; i++) {
|
||||
SOCKET_T sockfd;
|
||||
@@ -197,7 +197,7 @@ int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
wolfSSL_free(ssl);
|
||||
CloseSocket(sockfd);
|
||||
}
|
||||
avg = current_time() - start;
|
||||
avg = current_time(0) - start;
|
||||
avg /= times;
|
||||
avg *= 1000; /* milliseconds */
|
||||
#ifndef NO_SESSION_CACHE
|
||||
@@ -219,7 +219,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
WOLFSSL* ssl;
|
||||
int ret;
|
||||
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL)
|
||||
err_sys("unable to get SSL object");
|
||||
@@ -232,7 +232,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
char *tx_buffer, *rx_buffer;
|
||||
|
||||
/* Record connection time */
|
||||
conn_time = current_time() - start;
|
||||
conn_time = current_time(0) - start;
|
||||
|
||||
/* Allocate TX/RX buffers */
|
||||
tx_buffer = (char*)malloc(TEST_BUFFER_SIZE);
|
||||
@@ -261,18 +261,18 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
|
||||
/* Perform TX */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
if (wolfSSL_write(ssl, tx_buffer, len) != len) {
|
||||
int writeErr = wolfSSL_get_error(ssl, 0);
|
||||
printf("wolfSSL_write error %d!\n", writeErr);
|
||||
err_sys("wolfSSL_write failed");
|
||||
}
|
||||
tx_time += current_time() - start;
|
||||
tx_time += current_time(0) - start;
|
||||
|
||||
/* Perform RX */
|
||||
select_ret = tcp_select(sockfd, 1); /* Timeout=1 second */
|
||||
if (select_ret == TEST_RECV_READY) {
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
rx_pos = 0;
|
||||
while(rx_pos < len) {
|
||||
ret = wolfSSL_read(ssl, &rx_buffer[rx_pos], len - rx_pos);
|
||||
@@ -287,7 +287,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
rx_pos += ret;
|
||||
}
|
||||
}
|
||||
rx_time += current_time() - start;
|
||||
rx_time += current_time(0) - start;
|
||||
}
|
||||
|
||||
/* Compare TX and RX buffers */
|
||||
|
@@ -125,7 +125,7 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern double current_time(void);
|
||||
extern double current_time(int);
|
||||
|
||||
/* Echo number of bytes specified by -e arg */
|
||||
int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
@@ -141,7 +141,7 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
int len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
int rx_pos = 0;
|
||||
if(throughput) {
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
}
|
||||
while(rx_pos < len) {
|
||||
ret = SSL_read(ssl, &buffer[rx_pos], len - rx_pos);
|
||||
@@ -157,14 +157,14 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
}
|
||||
}
|
||||
if(throughput) {
|
||||
rx_time += current_time() - start;
|
||||
start = current_time();
|
||||
rx_time += current_time(0) - start;
|
||||
start = current_time(1);
|
||||
}
|
||||
if (SSL_write(ssl, buffer, len) != len) {
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
if(throughput) {
|
||||
tx_time += current_time() - start;
|
||||
tx_time += current_time(0) - start;
|
||||
}
|
||||
|
||||
xfer_bytes += len;
|
||||
|
Reference in New Issue
Block a user