63 mHw->setReplyDelay(aDelay);
69 return measureReadLatency(std::vector<ClientInterface*>(1, &aClient), aBaseAddr, aDepth, aNrIterations, aDispatchEachIteration, aVerbose);
73 double measureReadLatency(
const std::vector<ClientInterface*>& aClients, uint32_t aBaseAddr, uint32_t aDepth,
size_t aNrIterations,
bool aDispatchEachIteration,
bool aVerbose)
75 typedef std::vector<ClientInterface*>::const_iterator ClientIterator_t;
78 for (
unsigned i = 0; i < aNrIterations ; ++i )
82 std::cout <<
"Iteration " << i << std::endl;
85 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
90 if ( aDispatchEachIteration )
92 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
99 if ( !aDispatchEachIteration )
101 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
113 return measureWriteLatency(std::vector<ClientInterface*>(1, &aClient), aBaseAddr, aDepth, aNrIterations, aDispatchEachIteration, aVerbose);
117 double measureWriteLatency(
const std::vector<ClientInterface*>& aClients, uint32_t aBaseAddr, uint32_t aDepth,
size_t aNrIterations,
bool aDispatchEachIteration,
bool aVerbose)
119 typedef std::vector<ClientInterface*>::const_iterator ClientIterator_t;
122 std::vector<uint32_t> sendBuffer ( aDepth, 0xbebafeca );
125 for (
unsigned i = 0; i < aNrIterations ; ++i )
129 std::cout <<
"Iteration " << i << std::endl;
133 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
138 if ( aDispatchEachIteration )
140 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
147 if ( !aDispatchEachIteration )
149 for (ClientIterator_t lIt = aClients.begin(); lIt != aClients.end(); lIt++)
159 double measureFileReadLatency(
const std::string& aFilePath, uint32_t aBaseAddr, uint32_t aDepth,
size_t aNrIterations,
bool aVerbose)
161 PCIe::File lFile(aFilePath, O_RDWR | O_NONBLOCK);
164 std::vector<uint32_t> lRecvBuffer;
165 lFile.
read(aBaseAddr, aDepth, lRecvBuffer);
169 for (
unsigned i = 0; i < aNrIterations ; ++i )
173 std::cout <<
"Iteration " << i << std::endl;
176 lFile.
read(aBaseAddr, aDepth, lRecvBuffer);
184 double measureFileWriteLatency(
const std::string& aFilePath, uint32_t aBaseAddr, uint32_t aDepth,
size_t aNrIterations,
bool aVerbose)
187 std::vector<uint32_t> lSendBuffer(aDepth, 0x0);
188 lFile.
write(aBaseAddr, lSendBuffer);
191 for (
unsigned i = 0; i < aNrIterations ; ++i )
195 std::cout <<
"Iteration " << i << std::endl;
198 lFile.
write(aBaseAddr, lSendBuffer);