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