52 volatile UINT64 totalBytesProcessed;
57 CAMsg::printMsg(LOG_DEBUG,
"Do crypto benchmark for %u threads\n", numThreads);
58 totalBytesProcessed = 0;
59 UINT64 startTime, endTime, time;
61 for (
UINT32 nThreads = 0; nThreads < numThreads; nThreads++)
69 pThread->
start(pParams,
false,
true);
70 pThreadList->
put(pThread);
74 time =
diff64(endTime, startTime);
79 numThreads -= (numThreads % 4);
83 delete pMutexTotlaBytes;
90 *(pTimerParams->
bTimer) =
false;
102 volatile bool bTimer =
true;
107 pTimerParams->
bTimer = &bTimer;
112 UINT64 startTime, endTime, time;
113 pTimerThread->
start(pTimerParams,
true,
true);
117 pCipher->
crypt1(in, out, blocksize);
121 time =
diff64( endTime,startTime);
125 UINT64 bytes = numCrypts * 1000 * blocksize;
129 CAMsg::printMsg(LOG_DEBUG,
"Did %llu crypts in %u ms - blocksize %u - %s\n", numCrypts,(
UINT32) time, blocksize, tmpbuff);
#define MAX_CRYPTOBENCHMARK_THREADS
struct t_benchmarkParams tBenchmarkParams
struct t_benchmarkTimerParams tBenchmarkTimerParams
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
void formatBytesPerSecond(UINT8 *buff, UINT32 buffsize, UINT64 bytespersecond)
SINT32 msSleep(UINT32 ms)
Sleeps ms milliseconds.
UINT32 diff64(const UINT64 &bigop, const UINT64 &smallop)
#define THREAD_RETURN_SUCCESS
static const UINT32 ms_NUM_BLOCKSIZES
static THREAD_RETURN timerThread(void *param)
static const UINT32 ms_BlockSizes[ms_NUM_BLOCKSIZES]
static THREAD_RETURN benchmarkThread(void *param)
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
virtual SINT32 setKeys(const UINT8 *key, UINT32 keysize)=0
Sets the keys for crypt1() and crypt2() either to the same key (if keysize==KEY_SIZE) or to different...
virtual SINT32 setIVs(const UINT8 *p_iv)=0
Sets iv1 and iv2 to p_iv.
virtual SINT32 crypt1(const UINT8 *in, UINT8 *out, UINT32 len)=0
This class could be used for encryption/decryption of data (streams) with AES using 128bit CTR mode.
SINT32 start(void *param, bool bDaemon=false, bool bSilent=false)
Starts the execution of the main function of this thread.
SINT32 setMainLoop(THREAD_MAIN_TYP fnc)
Sets the main function which will be executed within this thread.
SINT32 waitAndRemoveAll()
Waits for finishing of all threads in list and removes them.
SINT32 put(const CAThread *const thread)
volatile UINT64 * outparam_pTotalBytesProcessed
CAMutex * pMutexTotalBytesProcessed