forked from wolfSSL/wolfssl
WOLFSSL_FUNC_TIME changes
Warning in code about using this define. Remove usage of WOLFSSL_FUNC_TIME from server.c.
This commit is contained in:
@ -484,9 +484,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
int resume = 0;
|
int resume = 0;
|
||||||
int resumeCount = 0;
|
int resumeCount = 0;
|
||||||
int loops = 1;
|
int loops = 1;
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
#endif
|
|
||||||
int echoData = 0;
|
int echoData = 0;
|
||||||
int block = TEST_BUFFER_SIZE;
|
int block = TEST_BUFFER_SIZE;
|
||||||
int throughput = 0;
|
int throughput = 0;
|
||||||
@ -1641,15 +1639,14 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
}
|
}
|
||||||
resumeCount = 0;
|
resumeCount = 0;
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
|
||||||
cnt++;
|
cnt++;
|
||||||
#endif
|
|
||||||
if (loops > 0 && --loops == 0) {
|
if (loops > 0 && --loops == 0) {
|
||||||
break; /* out of while loop, done with normal and resume option */
|
break; /* out of while loop, done with normal and resume option */
|
||||||
}
|
}
|
||||||
} /* while(1) */
|
} /* while(1) */
|
||||||
|
|
||||||
WOLFSSL_TIME(cnt);
|
WOLFSSL_TIME(cnt);
|
||||||
|
(void)cnt;
|
||||||
|
|
||||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||||
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||||
|
@ -57,6 +57,10 @@ static struct wc_error_queue* wc_last_node;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
#ifdef WOLFSSL_FUNC_TIME
|
||||||
|
/* WARNING: This code is only to be used for debugging performance.
|
||||||
|
* The code is not thread-safe.
|
||||||
|
* Do not use WOLFSSL_FUNC_TIME in production code.
|
||||||
|
*/
|
||||||
static double wc_func_start[WC_FUNC_COUNT];
|
static double wc_func_start[WC_FUNC_COUNT];
|
||||||
static double wc_func_time[WC_FUNC_COUNT] = { 0, };
|
static double wc_func_time[WC_FUNC_COUNT] = { 0, };
|
||||||
static const char* wc_func_name[WC_FUNC_COUNT] = {
|
static const char* wc_func_name[WC_FUNC_COUNT] = {
|
||||||
@ -94,52 +98,18 @@ static const char* wc_func_name[WC_FUNC_COUNT] = {
|
|||||||
"DoEarlyData",
|
"DoEarlyData",
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(WOLFSSL_USER_CURRTIME)
|
#include <sys/time.h>
|
||||||
extern double current_time(int reset);
|
|
||||||
|
|
||||||
#elif defined(USE_WINDOWS_API)
|
/* WARNING: This function is not portable. */
|
||||||
|
static INLINE double current_time(int reset)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, 0);
|
||||||
|
(void)reset;
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
||||||
#include <windows.h>
|
}
|
||||||
|
#endif /* WOLFSSL_FUNC_TIME */
|
||||||
static INLINE double current_time(int reset)
|
|
||||||
{
|
|
||||||
static int init = 0;
|
|
||||||
static LARGE_INTEGER freq;
|
|
||||||
|
|
||||||
LARGE_INTEGER count;
|
|
||||||
|
|
||||||
if (!init) {
|
|
||||||
QueryPerformanceFrequency(&freq);
|
|
||||||
init = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryPerformanceCounter(&count);
|
|
||||||
|
|
||||||
(void)reset;
|
|
||||||
return (double)count.QuadPart / freq.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(WOLFSSL_TIRTOS)
|
|
||||||
extern double current_time();
|
|
||||||
#else
|
|
||||||
|
|
||||||
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && !defined(WOLFSSL_CHIBIOS)
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
static INLINE double current_time(int reset)
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday(&tv, 0);
|
|
||||||
(void)reset;
|
|
||||||
|
|
||||||
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern double current_time(int reset);
|
|
||||||
#endif
|
|
||||||
#endif /* USE_WINDOWS_API */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_WOLFSSL
|
#ifdef DEBUG_WOLFSSL
|
||||||
|
|
||||||
@ -182,6 +152,10 @@ void wolfSSL_Debugging_OFF(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
#ifdef WOLFSSL_FUNC_TIME
|
||||||
|
/* WARNING: This code is only to be used for debugging performance.
|
||||||
|
* The code is not thread-safe.
|
||||||
|
* Do not use WOLFSSL_FUNC_TIME in production code.
|
||||||
|
*/
|
||||||
void WOLFSSL_START(int funcNum)
|
void WOLFSSL_START(int funcNum)
|
||||||
{
|
{
|
||||||
double now = current_time(0) * 1000.0;
|
double now = current_time(0) * 1000.0;
|
||||||
|
@ -46,6 +46,10 @@ enum wc_LogLevels {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
#ifdef WOLFSSL_FUNC_TIME
|
||||||
|
/* WARNING: This code is only to be used for debugging performance.
|
||||||
|
* The code is not thread-safe.
|
||||||
|
* Do not use WOLFSSL_FUNC_TIME in production code.
|
||||||
|
*/
|
||||||
enum wc_FuncNum {
|
enum wc_FuncNum {
|
||||||
WC_FUNC_CLIENT_HELLO_SEND = 0,
|
WC_FUNC_CLIENT_HELLO_SEND = 0,
|
||||||
WC_FUNC_CLIENT_HELLO_DO,
|
WC_FUNC_CLIENT_HELLO_DO,
|
||||||
@ -113,6 +117,10 @@ WOLFSSL_API void wolfSSL_Debugging_OFF(void);
|
|||||||
#endif /* OPENSSL_EXTRA || DEBUG_WOLFSSL_VERBOSE */
|
#endif /* OPENSSL_EXTRA || DEBUG_WOLFSSL_VERBOSE */
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
#ifdef WOLFSSL_FUNC_TIME
|
||||||
|
/* WARNING: This code is only to be used for debugging performance.
|
||||||
|
* The code is not thread-safe.
|
||||||
|
* Do not use WOLFSSL_FUNC_TIME in production code.
|
||||||
|
*/
|
||||||
WOLFSSL_API void WOLFSSL_START(int funcNum);
|
WOLFSSL_API void WOLFSSL_START(int funcNum);
|
||||||
WOLFSSL_API void WOLFSSL_END(int funcNum);
|
WOLFSSL_API void WOLFSSL_END(int funcNum);
|
||||||
WOLFSSL_API void WOLFSSL_TIME(int count);
|
WOLFSSL_API void WOLFSSL_TIME(int count);
|
||||||
|
Reference in New Issue
Block a user