From 35c5353698191e3db3f614c18badefc30110e9c7 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Thu, 14 Apr 2016 16:26:51 +0900 Subject: [PATCH] fixed current_time argument --- examples/client/client.c | 18 +++++++++--------- examples/server/server.c | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/client/client.c b/examples/client/client.c index c96c0f93f..24d5b09b0 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -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 */ diff --git a/examples/server/server.c b/examples/server/server.c index 73c90cc31..c8ef0c389 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -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;