29 #ifndef ONLY_LOCAL_PROXY
87 UINT16 timestamp=(key[14]<<8)|key[15];
102 UINT16 hashKey=(key[8]<<8)|key[9];
108 newEntry->
right=NULL;
109 newEntry->
key=key[0]<<24|key[1]<<16|key[2]<<8|key[3];
117 UINT32 ret=key[0]<<24|key[1]<<16|key[2]<<8|key[3];;
122 if(ret==hashList->
key)
128 if(hashList->
key<ret)
130 hashList=hashList->
right;
134 hashList=hashList->
left;
136 }
while(hashList!=NULL);
143 before->
right=newEntry;
146 before->
left=newEntry;
188 if(secondsTilNextClock<=0&&pDatabase->m_bRun)
225 for(i=0;i<200000;i++)
257 UINT32 timeDiff=aktTime-refTime;
273 UINT32 aktNrOfEntries=lowerBoundEntries;
278 const char* atemplate=
"%u,%u,%u\n";
279 const char* header=
"#The format is as follows: Number of Entries in DB, Number of Inserts done, Total time for Inserts (in micro seconds)\n";
281 while(aktNrOfEntries<=upperBoundEntries)
283 CAMsg::printMsg(LOG_DEBUG,
"Starting measurement with %u entries in the replay database\n",aktNrOfEntries);
284 for(
UINT32 i=0;i<meassuresPerStep;i++)
288 pDatabase->
fill(aktNrOfEntries);
292 for(
UINT32 j=0;j<insertsPerMeasure;j++)
301 for(
UINT32 j=0;j<insertsPerMeasure;j++)
307 sprintf(buff,atemplate,aktNrOfEntries,insertsPerMeasure,
diff64(endTime,startTime));
309 printf(
"Start delete \n");
313 printf(
"delete takes %u microsecs\n",
diff64(endTime,startTime));
315 aktNrOfEntries+=stepBy;
339 UINT16 timestamp=(key[14]<<8)|key[15];
354 UINT16 hashKey=(key[8]<<8)|key[9];
360 newEntry->
right=NULL;
361 newEntry->
key=key[0]<<24|key[1]<<16|key[2]<<8|key[3];
369 UINT32 ret=key[0]<<24|key[1]<<16|key[2]<<8|key[3];
374 if(ret==hashList->
key)
380 if(hashList->
key<ret)
382 hashList=hashList->
right;
386 hashList=hashList->
left;
388 }
while(hashList!=NULL);
395 newEntry->
right=newEntry;
399 newEntry->
left=newEntry;
#define SECONDS_PER_INTERVALL
THREAD_RETURN replaydb_loopMaintenance(void *param)
struct __t_database_info t_replay_databaseInfo
#define BEGIN_STACK(methodName)
#define FINISH_STACK(methodName)
SINT32 getcurrentTimeMicros(UINT64 &u64Time)
Gets the current Systemtime in micros seconds.
SINT32 sSleep(UINT32 sec)
Sleeps sec Seconds.
SINT32 getRandom(UINT32 *val)
Gets 32 random bits.
UINT32 diff64(const UINT64 &bigop, const UINT64 &smallop)
#define THREAD_RETURN_SUCCESS
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
SINT32 getCurrentReplayTimestamp(tReplayTimestamp &replayTimestamp) const
Returns the current Replay timestamp for this database.
t_replay_databaseInfo * m_currDatabase
t_replay_databaseInfo * m_prevDatabase
friend THREAD_RETURN replaydb_loopMaintenance(void *param)
SINT32 insert(UINT8 key[16])
Inserts this key in the replay DB.
static SINT32 measurePerformance(UINT8 *strLogFile, UINT32 lowerBoundEntries, UINT32 upperBoundEntries, UINT32 stepBy, UINT32 meassuresPerStep, UINT32 insertsPerMeasure)
This mehtod can be used to measure the performance of the Replay database.
SINT32 deleteDB(t_replay_databaseInfo *&pDB)
Deletes the whole database pDB.
t_replay_databaseInfo * createDBInfo()
Creates and initialises a dbinfo struct.
SINT32 simulateInsert(UINT8 key[16])
This is a modified copy of insert() which simulates the insert() function as close as possible withou...
t_replay_databaseInfo * m_nextDatabase
SINT32 clearDB(t_replay_databaseInfo *pDB)
clears the whole database pDB - but does not delete the hashtable pDB
SINT32 fill(UINT32 nrOfEntries)
Pre fills the database with nrOfEntries random entries.
LP_replay_databaseEntry getNewDBEntry(t_replay_databaseInfo *pDB)
volatile SINT32 m_currentClock
static SINT32 getReplayTimestampForTime(tReplayTimestamp &replayTimestamp, UINT32 aktTime, UINT32 refTime)
Returns the replay timestamp for this reference time (seconds since epoch) and time.
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 join()
Waits for the main function to finish execution.
t_replay_databaseHeap * m_pHeap
t_replay_databaseHeap * m_pLastHeap
LP_replay_databaseEntry m_pHashTable[0x10000]
__t_replay_database_entry * right
__t_replay_database_entry * left
__t_replay_database_heap * next