Mixe for Privacy and Anonymity in the Internet
|
#include <CAReplayDatabase.hpp>
Public Member Functions | |
CAReplayDatabase () | |
~CAReplayDatabase () | |
SINT32 | insert (UINT8 key[16]) |
Inserts this key in the replay DB. More... | |
SINT32 | start () |
SINT32 | stop () |
SINT32 | getCurrentReplayTimestamp (tReplayTimestamp &replayTimestamp) const |
Returns the current Replay timestamp for this database. More... | |
UINT32 | getRefTime () const |
Returns the local time in seconds since epoch for replay timestamp='0' for this database. More... | |
Static Public Member Functions | |
static SINT32 | getReplayTimestampForTime (tReplayTimestamp &replayTimestamp, UINT32 aktTime, UINT32 refTime) |
Returns the replay timestamp for this reference time (seconds since epoch) and time. More... | |
static SINT32 | getTimeForReplayTimestamp (UINT32 &refTime, tReplayTimestamp replayTimestamp) |
Returns the refernce time (seconds since epoch) for the given replay timestamp. More... | |
static SINT32 | test () |
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. More... | |
Private Member Functions | |
LP_replay_databaseEntry | getNewDBEntry (t_replay_databaseInfo *pDB) |
t_replay_databaseInfo * | createDBInfo () |
Creates and initialises a dbinfo struct. More... | |
SINT32 | clearDB (t_replay_databaseInfo *pDB) |
clears the whole database pDB - but does not delete the hashtable pDB More... | |
SINT32 | deleteDB (t_replay_databaseInfo *&pDB) |
Deletes the whole database pDB. More... | |
SINT32 | nextClock () |
SINT32 | fill (UINT32 nrOfEntries) |
Pre fills the database with nrOfEntries random entries. More... | |
SINT32 | simulateInsert (UINT8 key[16]) |
This is a modified copy of insert() which simulates the insert() function as close as possible without actually changing the replay database. More... | |
Private Attributes | |
t_replay_databaseInfo * | m_currDatabase |
t_replay_databaseInfo * | m_nextDatabase |
t_replay_databaseInfo * | m_prevDatabase |
volatile bool | m_bRun |
UINT32 | m_refTime |
volatile SINT32 | m_currentClock |
CAMutex * | m_pMutex |
CAThread * | m_pThread |
Friends | |
THREAD_RETURN | replaydb_loopMaintenance (void *param) |
Definition at line 64 of file CAReplayDatabase.hpp.
CAReplayDatabase::CAReplayDatabase | ( | ) |
Definition at line 34 of file CAReplayDatabase.cpp.
References createDBInfo(), m_currDatabase, m_currentClock, m_nextDatabase, m_pMutex, m_prevDatabase, m_pThread, and m_refTime.
Referenced by measurePerformance().
CAReplayDatabase::~CAReplayDatabase | ( | ) |
Definition at line 52 of file CAReplayDatabase.cpp.
References deleteDB(), CAMutex::lock(), m_currDatabase, m_nextDatabase, m_pMutex, m_prevDatabase, stop(), and CAMutex::unlock().
|
private |
clears the whole database pDB - but does not delete the hashtable pDB
pDB | database to delete |
Definition at line 63 of file CAReplayDatabase.cpp.
References E_SUCCESS, __t_database_info::m_pHeap, __t_database_info::m_pLastHeap, and __t_replay_database_heap::next.
Referenced by deleteDB(), and nextClock().
|
private |
Creates and initialises a dbinfo struct.
Definition at line 45 of file CAReplayDatabase.cpp.
Referenced by CAReplayDatabase().
|
private |
Deletes the whole database pDB.
pDB | database to delete |
Definition at line 75 of file CAReplayDatabase.cpp.
References clearDB(), and E_SUCCESS.
Referenced by ~CAReplayDatabase().
Pre fills the database with nrOfEntries random entries.
nrOfEntries | number of entries to put in the database |
Definition at line 321 of file CAReplayDatabase.cpp.
References E_SUCCESS, getRandom(), and insert().
Referenced by measurePerformance().
SINT32 CAReplayDatabase::getCurrentReplayTimestamp | ( | tReplayTimestamp & | replayTimestamp | ) | const |
Returns the current Replay timestamp for this database.
Returns the current replay timestamp for this database.
replayTimestamp | stores the current replay timestamp |
Definition at line 249 of file CAReplayDatabase.cpp.
References getReplayTimestampForTime(), and m_refTime.
Referenced by nextClock().
|
inlineprivate |
Definition at line 112 of file CAReplayDatabase.hpp.
References __t_replay_database_heap::m_pEntries, __t_database_info::m_pHeap, __t_database_info::m_pLastHeap, __t_database_info::m_s32FreeEntries, __t_replay_database_heap::next, and REPLAY_DB_ENTRIES_PER_HEAP.
Referenced by insert(), and simulateInsert().
|
inline |
Returns the local time in seconds since epoch for replay timestamp='0' for this database.
Definition at line 76 of file CAReplayDatabase.hpp.
References m_refTime.
|
static |
Returns the replay timestamp for this reference time (seconds since epoch) and time.
Definition at line 255 of file CAReplayDatabase.cpp.
References E_SUCCESS, t_replay_timestamp::interval, t_replay_timestamp::offset, and SECONDS_PER_INTERVALL.
Referenced by getCurrentReplayTimestamp().
|
inlinestatic |
Returns the refernce time (seconds since epoch) for the given replay timestamp.
Definition at line 85 of file CAReplayDatabase.hpp.
References E_SUCCESS, t_replay_timestamp::interval, t_replay_timestamp::offset, and SECONDS_PER_INTERVALL.
Inserts this key in the replay DB.
The last two bytes are the timestamp
Definition at line 84 of file CAReplayDatabase.cpp.
References E_UNKNOWN, getNewDBEntry(), __t_replay_database_entry::key, __t_replay_database_entry::left, CAMutex::lock(), m_currDatabase, m_currentClock, m_nextDatabase, __t_database_info::m_pHashTable, m_pMutex, m_prevDatabase, __t_replay_database_entry::right, and CAMutex::unlock().
Referenced by fill(), and test().
|
static |
This mehtod can be used to measure the performance of the Replay database.
The results are stored in a file in csv format. Ths method will do several measures with different numbers of elements in the database. These number could be specified using owerBoundEntries,upperBoundEntries and stepBy.
strLogFile | the log file name |
lowerBoundEntries | the number of entries in the database (at beginn) |
upperBoundEntries | the number of entries in the database (at end) |
stepBy | how many entries should be added for each new measurement |
meassuresPerStep | how many measure values should be generate per step. That means that the experiement is repeated this many times. |
insertsPerMeasure | one measure value will be the time: (Total Insertion Time)/insertsPerMeasure |
Definition at line 264 of file CAReplayDatabase.cpp.
References CAReplayDatabase(), diff64(), E_SUCCESS, fill(), getcurrentTimeMicros(), getRandom(), initRandom(), m_currentClock, myfilewrite, O_LARGEFILE, CAMsg::printMsg(), S_IREAD, S_IWRITE, and simulateInsert().
Referenced by main().
|
private |
Definition at line 197 of file CAReplayDatabase.cpp.
References clearDB(), E_SUCCESS, getCurrentReplayTimestamp(), t_replay_timestamp::interval, CAMutex::lock(), m_currDatabase, m_currentClock, m_nextDatabase, m_pMutex, m_prevDatabase, __t_database_info::m_u32Size, CAMsg::printMsg(), and CAMutex::unlock().
This is a modified copy of insert() which simulates the insert() function as close as possible without actually changing the replay database.
Definition at line 336 of file CAReplayDatabase.cpp.
References E_SUCCESS, E_UNKNOWN, getNewDBEntry(), __t_replay_database_entry::key, __t_replay_database_entry::left, CAMutex::lock(), m_currDatabase, m_currentClock, m_nextDatabase, __t_database_info::m_pHashTable, m_pMutex, m_prevDatabase, __t_database_info::m_u32Size, __t_replay_database_entry::right, and CAMutex::unlock().
Referenced by measurePerformance().
SINT32 CAReplayDatabase::start | ( | ) |
Definition at line 154 of file CAReplayDatabase.cpp.
References m_bRun, m_pThread, replaydb_loopMaintenance, CAThread::setMainLoop(), and CAThread::start().
Referenced by test().
SINT32 CAReplayDatabase::stop | ( | ) |
Definition at line 162 of file CAReplayDatabase.cpp.
References E_SUCCESS, CAThread::join(), m_bRun, and m_pThread.
Referenced by test(), and ~CAReplayDatabase().
|
static |
TODO WRONG - fixme
Definition at line 213 of file CAReplayDatabase.cpp.
References E_SUCCESS, getRandom(), insert(), start(), and stop().
|
friend |
Definition at line 175 of file CAReplayDatabase.cpp.
Referenced by start().
|
private |
Definition at line 158 of file CAReplayDatabase.hpp.
|
private |
Definition at line 155 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), insert(), nextClock(), simulateInsert(), and ~CAReplayDatabase().
|
private |
Definition at line 160 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), insert(), measurePerformance(), nextClock(), and simulateInsert().
|
private |
Definition at line 156 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), insert(), nextClock(), simulateInsert(), and ~CAReplayDatabase().
|
private |
Definition at line 161 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), insert(), nextClock(), simulateInsert(), and ~CAReplayDatabase().
|
private |
Definition at line 157 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), insert(), nextClock(), simulateInsert(), and ~CAReplayDatabase().
|
private |
Definition at line 162 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), start(), and stop().
|
private |
Definition at line 159 of file CAReplayDatabase.hpp.
Referenced by CAReplayDatabase(), getCurrentReplayTimestamp(), and getRefTime().