|
μHAL (v2.7.9)
Part of the IPbus software repository
|
Go to the documentation of this file.
42 #include <boost/test/unit_test.hpp>
43 #include <boost/filesystem.hpp>
59 double totalSeconds =
measureReadLatency(aClient, aBaseAddr, aDepth, aNrIterations, aDispatchEachIteration,
false);
60 double totalPayloadKB = aNrIterations * aDepth * 4. / 1024.;
61 double dataRateKB_s = totalPayloadKB/totalSeconds;
62 std::cout <<
" --> " << aNrIterations <<
" reads, each " << aDepth <<
" x 32-bit words, took " << totalSeconds <<
" seconds" << std::endl
63 <<
"Total IPbus payload received = " << totalPayloadKB <<
" KB\n"
64 <<
"Average read bandwidth = " << dataRateKB_s <<
" KB/s" << std::endl;
70 double totalSeconds =
measureWriteLatency(aClient, aBaseAddr, aDepth, aNrIterations, aDispatchEachIteration,
false);
71 double totalPayloadKB = aNrIterations * aDepth * 4. / 1024.;
72 double dataRateKB_s = totalPayloadKB/totalSeconds;
73 std::cout <<
" --> " << aNrIterations <<
" writes, each " << aDepth <<
" x 32-bit words, took " << totalSeconds <<
" seconds" << std::endl
74 <<
"Total IPbus payload received = " << totalPayloadKB <<
" KB\n"
75 <<
"Average read bandwidth = " << dataRateKB_s <<
" KB/s" << std::endl;
83 BOOST_TEST_MESSAGE(
" *** Skipping soak tests since '--quick' flag was used ***");
97 BOOST_TEST_MESSAGE(
" *** Skipping soak tests since '--quick' flag was used ***");
112 BOOST_TEST_MESSAGE(
" *** Skipping soak tests since '--quick' flag was used ***");
114 HwInterface
hw = getHwInterface();
116 std::vector<ClientInterface*> lClients;
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
BOOST_CHECK(!mem.valid())
An abstract base class for defining the interface to the various IPbus clients as well as providing t...
static bool runValidationTest(const std::vector< ClientInterface * > &aClients, const uint32_t aBaseAddr, const uint32_t aDepth, const size_t aNrIterations, const bool aDispatchEachIteration, const bool aVerbose)
void report_tx_performance(ClientInterface &aClient, const uint32_t aBaseAddr, const uint32_t aDepth, const size_t aNrIterations, const bool aDispatchEachIteration)
double measureWriteLatency(ClientInterface &aClient, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)
ClientInterface & getClient()
Get the underlying IPbus client.
UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite, block_write_read, DummyHardwareFixture, { std::vector< size_t > lDepths=getBlockUnitTestDepths(quickTest ? N_1MB :N_10MB);for(size_t i=0;i< lDepths.size();i++) { const size_t N=lDepths.at(i);BOOST_TEST_MESSAGE(" N = "<< N);HwInterface hw=getHwInterface();std::vector< uint32_t > xx;xx.reserve(N);for(size_t i=0;i!=N;++i) { xx.push_back(static_cast< uint32_t >(rand()));} hw.getNode("LARGE_MEM").writeBlock(xx);ValVector< uint32_t > mem=hw.getNode("LARGE_MEM").readBlock(N);BOOST_CHECK(!mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N > 0) { BOOST_CHECK_THROW(mem.at(0), uhal::exception::NonValidatedMemory);} BOOST_CHECK_THROW(mem.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N< N_10MB) { bool correct_block_write_read=true;std::vector< uint32_t >::const_iterator j=xx.begin();for(ValVector< uint32_t >::const_iterator i(mem.begin());i!=mem.end();++i,++j) { correct_block_write_read=correct_block_write_read &&(*i== *j);} BOOST_CHECK(correct_block_write_read);} } }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite
void report_rx_performance(ClientInterface &aClient, const uint32_t aBaseAddr, const uint32_t aDepth, const size_t aNrIterations, const bool aDispatchEachIteration)
BOOST_CHECK_NO_THROW(hw.getNode("REG").writeBlock(xx))
double measureReadLatency(ClientInterface &aClient, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)