Mixe for Privacy and Anonymity in the Internet
|
#include <CADatabase.hpp>
Public Member Functions | |
CADatabase () | |
~CADatabase () | |
SINT32 | insert (UINT8 key[16], UINT64 timestamp) |
Inserts this key in the replay DB. More... | |
SINT32 | start () |
SINT32 | stop () |
SINT32 | test () |
Static Public Member Functions | |
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 | |
t_databaseInfo * | createDBInfo () |
Creates and initialises a dbinfo struct. More... | |
SINT32 | clearDB (t_databaseInfo *pDB) |
clears the whole database pDB - but does not delete the hashtable pDB More... | |
SINT32 | deleteDB (t_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 | |
UINT64 | m_lastSwitch |
t_databaseInfo * | m_currDatabase |
t_databaseInfo * | m_nextDatabase |
t_databaseInfo * | m_prevDatabase |
volatile bool | m_bRun |
volatile SINT32 | m_currentClock |
CAMutex * | m_pMutex |
CAThread * | m_pThread |
Friends | |
THREAD_RETURN | db_loopMaintenance (void *param) |
Definition at line 53 of file CADatabase.hpp.
CADatabase::CADatabase | ( | ) |
Definition at line 34 of file CADatabase.cpp.
References createDBInfo(), m_currDatabase, m_currentClock, m_lastSwitch, m_nextDatabase, m_pMutex, m_prevDatabase, and m_pThread.
Referenced by measurePerformance().
CADatabase::~CADatabase | ( | ) |
Definition at line 52 of file CADatabase.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 64 of file CADatabase.cpp.
References _t_database_info::m_pHashTable, and _t_database_entry::next.
Referenced by deleteDB(), and nextClock().
|
private |
Creates and initialises a dbinfo struct.
Definition at line 45 of file CADatabase.cpp.
Referenced by CADatabase().
|
private |
Deletes the whole database pDB.
pDB | database to delete |
Definition at line 84 of file CADatabase.cpp.
References clearDB(), and E_SUCCESS.
Referenced by ~CADatabase().
Pre fills the database with nrOfEntries random entries.
nrOfEntries | number of entries to put in the database |
Definition at line 354 of file CADatabase.cpp.
References E_SUCCESS, getRandom(), and insert().
Referenced by measurePerformance(), and test().
Inserts this key in the replay DB.
Definition at line 93 of file CADatabase.cpp.
References E_SUCCESS, E_UNKNOWN, FUTURE_TOLERANCE, _t_database_entry::key, CAMutex::lock(), m_currDatabase, m_lastSwitch, m_nextDatabase, _t_database_info::m_pHashTable, m_pMutex, m_prevDatabase, _t_database_info::m_u32Size, _t_database_entry::next, SECONDS_PER_INTERVALL, and CAMutex::unlock().
Referenced by fill(), CAFirstMixA::loop(), CALastMixA::loop(), and CALastMixB::loop().
|
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 303 of file CADatabase.cpp.
References CADatabase(), diff64(), E_SUCCESS, fill(), getcurrentTimeMicros(), getRandom(), initRandom(), O_LARGEFILE, CAMsg::printMsg(), S_IREAD, S_IWRITE, and simulateInsert().
|
private |
Definition at line 262 of file CADatabase.cpp.
References clearDB(), E_SUCCESS, CAMutex::lock(), m_currDatabase, m_lastSwitch, m_nextDatabase, m_pMutex, m_prevDatabase, _t_database_info::m_u32Size, CAMsg::printMsg(), SECONDS_PER_INTERVALL, 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 368 of file CADatabase.cpp.
References E_SUCCESS, CAMutex::lock(), m_currDatabase, m_currentClock, m_pMutex, _t_database_info::m_u32Size, and CAMutex::unlock().
Referenced by measurePerformance().
SINT32 CADatabase::start | ( | ) |
Definition at line 220 of file CADatabase.cpp.
References db_loopMaintenance, m_bRun, m_pThread, CAThread::setMainLoop(), and CAThread::start().
Referenced by CAFirstMix::init(), and CAMiddleMix::init().
SINT32 CADatabase::stop | ( | ) |
Definition at line 228 of file CADatabase.cpp.
References E_SUCCESS, CAThread::join(), m_bRun, and m_pThread.
Referenced by ~CADatabase().
SINT32 CADatabase::test | ( | ) |
Definition at line 277 of file CADatabase.cpp.
References E_SUCCESS, and fill().
|
friend |
|
private |
Definition at line 107 of file CADatabase.hpp.
|
private |
Definition at line 104 of file CADatabase.hpp.
Referenced by CADatabase(), insert(), nextClock(), simulateInsert(), and ~CADatabase().
|
private |
Definition at line 109 of file CADatabase.hpp.
Referenced by CADatabase(), and simulateInsert().
|
private |
Definition at line 103 of file CADatabase.hpp.
Referenced by CADatabase(), insert(), and nextClock().
|
private |
Definition at line 105 of file CADatabase.hpp.
Referenced by CADatabase(), insert(), nextClock(), and ~CADatabase().
|
private |
Definition at line 110 of file CADatabase.hpp.
Referenced by CADatabase(), insert(), nextClock(), simulateInsert(), and ~CADatabase().
|
private |
Definition at line 106 of file CADatabase.hpp.
Referenced by CADatabase(), insert(), nextClock(), and ~CADatabase().
|
private |
Definition at line 111 of file CADatabase.hpp.
Referenced by CADatabase(), start(), and stop().