|
reSIProcate/rutil
9694
|


Public Member Functions | |
| TestRandomThread (int runs, Barrier &barrier, int storeBytes) | |
| ~TestRandomThread () | |
| virtual void | thread () |
| void | makeAndStoreRandoms (int numCycles) |
| const DataSet & | getRandoms () const |
| int | getDupCnt () const |
Static Public Member Functions | |
| static void | makeRandoms (int numCycles) |
Protected Attributes | |
| int | mNumRuns |
| Barrier & | mBarrier |
| int | mStoreBytes |
| DataSet | mRandoms |
| int | mDupCnt |
Definition at line 82 of file testRandomThread.cxx.
| TestRandomThread::TestRandomThread | ( | int | runs, |
| Barrier & | barrier, | ||
| int | storeBytes | ||
| ) | [inline] |
Definition at line 85 of file testRandomThread.cxx.
: mNumRuns(runs), mBarrier(barrier), mStoreBytes(storeBytes), mDupCnt(0) { };
| TestRandomThread::~TestRandomThread | ( | ) | [inline] |
Definition at line 89 of file testRandomThread.cxx.
{ };
| int TestRandomThread::getDupCnt | ( | ) | const [inline] |
Definition at line 95 of file testRandomThread.cxx.
Referenced by doThreadedTest().
{ return mDupCnt; }
| const DataSet& TestRandomThread::getRandoms | ( | ) | const [inline] |
Definition at line 94 of file testRandomThread.cxx.
Referenced by doThreadedTest().
{ return mRandoms; };
| void TestRandomThread::makeAndStoreRandoms | ( | int | numCycles | ) |
Definition at line 121 of file testRandomThread.cxx.
References RANDSEQ_PER_CYCLE.
{
int idx, cidx;
for (cidx=0; cidx < numCycles; cidx++)
{
for (idx = 0; idx < RANDSEQ_PER_CYCLE; idx++)
{
Data foo = Random::getRandomHex(mStoreBytes);
if (mRandoms.insert(foo).second == false )
{
++mDupCnt;
// std::cerr << "RandomHex produced intra-thread duplicate after "
// << idx << " calls."<<std::endl;
}
}
}
}
| void TestRandomThread::makeRandoms | ( | int | numCycles | ) | [static] |
Definition at line 107 of file testRandomThread.cxx.
References RANDINT_PER_CYCLE.
Referenced by doSingleTest().
{
int idx, cidx;
for (cidx=0; cidx < numCycles; cidx++)
{
for (idx = 0; idx < RANDINT_PER_CYCLE; idx++)
{
int val = Random::getRandom();
(void)val;
}
}
}
| void TestRandomThread::thread | ( | ) | [virtual] |
Implements resip::ThreadIf.
Definition at line 141 of file testRandomThread.cxx.
{
// do once to get over initialization
Random::getRandom();
// std::cerr << "Thread initialized." << std::endl;
mBarrier.sync(1);
if (mStoreBytes == 0 )
{
makeRandoms(mNumRuns);
}
else
{
makeAndStoreRandoms(mNumRuns);
}
mBarrier.sync(2);
}
Barrier& TestRandomThread::mBarrier [protected] |
Definition at line 99 of file testRandomThread.cxx.
int TestRandomThread::mDupCnt [protected] |
Definition at line 102 of file testRandomThread.cxx.
int TestRandomThread::mNumRuns [protected] |
Definition at line 98 of file testRandomThread.cxx.
DataSet TestRandomThread::mRandoms [protected] |
Definition at line 101 of file testRandomThread.cxx.
int TestRandomThread::mStoreBytes [protected] |
Definition at line 100 of file testRandomThread.cxx.
1.7.5.1