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 resumeCount = 0;
|
||||
int loops = 1;
|
||||
#ifdef WOLFSSL_FUNC_TIME
|
||||
int cnt = 0;
|
||||
#endif
|
||||
int echoData = 0;
|
||||
int block = TEST_BUFFER_SIZE;
|
||||
int throughput = 0;
|
||||
@ -1641,15 +1639,14 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
resumeCount = 0;
|
||||
|
||||
#ifdef WOLFSSL_FUNC_TIME
|
||||
cnt++;
|
||||
#endif
|
||||
if (loops > 0 && --loops == 0) {
|
||||
break; /* out of while loop, done with normal and resume option */
|
||||
}
|
||||
} /* while(1) */
|
||||
|
||||
WOLFSSL_TIME(cnt);
|
||||
(void)cnt;
|
||||
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||
|
@ -57,6 +57,10 @@ static struct wc_error_queue* wc_last_node;
|
||||
#endif
|
||||
|
||||
#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_time[WC_FUNC_COUNT] = { 0, };
|
||||
static const char* wc_func_name[WC_FUNC_COUNT] = {
|
||||
@ -94,39 +98,9 @@ static const char* wc_func_name[WC_FUNC_COUNT] = {
|
||||
"DoEarlyData",
|
||||
};
|
||||
|
||||
#if defined(WOLFSSL_USER_CURRTIME)
|
||||
extern double current_time(int reset);
|
||||
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
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>
|
||||
|
||||
/* WARNING: This function is not portable. */
|
||||
static INLINE double current_time(int reset)
|
||||
{
|
||||
struct timeval tv;
|
||||
@ -135,11 +109,7 @@ static const char* wc_func_name[WC_FUNC_COUNT] = {
|
||||
|
||||
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
||||
}
|
||||
#else
|
||||
extern double current_time(int reset);
|
||||
#endif
|
||||
#endif /* USE_WINDOWS_API */
|
||||
#endif
|
||||
#endif /* WOLFSSL_FUNC_TIME */
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
|
||||
@ -182,6 +152,10 @@ void wolfSSL_Debugging_OFF(void)
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
double now = current_time(0) * 1000.0;
|
||||
|
@ -46,6 +46,10 @@ enum wc_LogLevels {
|
||||
};
|
||||
|
||||
#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 {
|
||||
WC_FUNC_CLIENT_HELLO_SEND = 0,
|
||||
WC_FUNC_CLIENT_HELLO_DO,
|
||||
@ -113,6 +117,10 @@ WOLFSSL_API void wolfSSL_Debugging_OFF(void);
|
||||
#endif /* OPENSSL_EXTRA || DEBUG_WOLFSSL_VERBOSE */
|
||||
|
||||
#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_END(int funcNum);
|
||||
WOLFSSL_API void WOLFSSL_TIME(int count);
|
||||
|
Reference in New Issue
Block a user