#include <uhal/tests/PerfTester.hxx>
Classes | |
class | QueuedBlockRead |
class | QueuedBlockWrite |
class | QueuedRmwBits |
class | QueuedRmwSum |
class | QueuedTransaction |
Public Member Functions | |
PerfTester () | |
Constructor - takes no arguments, does nothing. More... | |
~PerfTester () | |
Destructor. More... | |
int | run (int argc, char *argv[]) |
Pass in the two command-line parameter variables, this will define the test that then gets run. More... | |
Static Public Member Functions | |
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) |
Private Types | |
typedef uint32_t | U32 |
An unsigned 32-bit word. More... | |
typedef std::vector< U32 > | U32Vec |
A vector of unsigned 32-bit words. More... | |
typedef uhal::ValVector< U32 > | U32ValVec |
A Validated Vector of U32. More... | |
typedef std::vector< std::string > | StringVec |
A vector of strings. More... | |
typedef void(PerfTester::* | PtrToTestFunc) () |
Function pointer typedef to a test function. More... | |
typedef std::map< std::string, PtrToTestFunc > | TestFuncMap |
Typedef for a map that links the name of a test to the function that performs it. More... | |
typedef std::map< std::string, std::string > | TestDescMap |
Typedef for a map that links the name of a test to its description. More... | |
typedef boost::shared_ptr< uhal::ClientInterface > | ClientPtr |
Typedef for a ClientInterface shared_ptr. More... | |
typedef std::vector< ClientPtr > | ClientVec |
Typedef for a vector of raw client interfaces. More... | |
Private Member Functions | |
void | outputHelpText (const std::string &argDescriptions) const |
Outputs the standard help text to screen. More... | |
void | outputTestDescriptionsList () const |
Outputs the test names and descriptions to screen. More... | |
bool | badInput () const |
Returns true if the user has entered bad command line arguments. More... | |
void | outputUserChoices () const |
Outputs the user's choices to screen. More... | |
void | buildClients () |
Constructs and sets up the appropriate IPbusClient for use in the test. More... | |
void | outputStandardResults (double totalSeconds) const |
Outputs a standard result set to screen - provide it with the number of seconds the test took. More... | |
bool | buffersEqual (const U32Vec &writeBuffer, const U32ValVec &readBuffer) const |
Compares a write buffer with one or more ValVec read responses. More... | |
void | bandwidthRxTest () |
Read bandwidth test. More... | |
void | bandwidthTxTest () |
Write bandwidth test. More... | |
void | validationTest () |
Historic basic firmware/software validation test. More... | |
void | sandbox () |
An area for a user-definable test. More... | |
Static Private Member Functions | |
static uint32_t | getRandomBlockSize (const uint32_t maxSize) |
Returns a random uint32_t in the range [0,maxSize], with 1/x probability distribution – so that p(x=0) = p(2<=x<4) = p(2^n <= x < 2^n+1) More... | |
static U32Vec | getRandomBuffer (unsigned size) |
Returns a buffer of random numbers. More... | |
static bool | validation_test_single_write_read (uhal::ClientInterface &c, const uint32_t addr, const bool perTransactionDispatch, const bool aVerbose) |
Validation test – single-register write/read-back. More... | |
static bool | validation_test_block_write_read (uhal::ClientInterface &c, const uint32_t addr, const uint32_t depth, const bool perTransactionDispatch, const bool aVerbose) |
Validation test – block write/read-back. More... | |
static bool | validation_test_write_rmwbits_read (uhal::ClientInterface &c, const uint32_t addr, const bool perTransactionDispatch, const bool aVerbose) |
Validation test – write, RMW bits, read. More... | |
static bool | validation_test_write_rmwsum_read (uhal::ClientInterface &c, const uint32_t addr, const bool perTransactionDispatch, const bool aVerbose) |
Validation test – write, RMW sum, read. More... | |
Private Attributes | |
TestDescMap | m_testDescMap |
Maps test name to test description. More... | |
TestFuncMap | m_testFuncMap |
Maps test name to test function. More... | |
StringVec | m_deviceURIs |
Vector of individual connection URI strings. More... | |
ClientVec | m_clients |
Vector of low-level uHAL clients. More... | |
std::string | m_testName |
Holds the test name. More... | |
uint64_t | m_iterations |
Number of test iterations. More... | |
std::string | m_baseAddrStr |
Base addr of reg/ram the test will use. Use a string as workaround for hex input via boost::program_options. More... | |
boost::uint32_t | m_baseAddr |
The m_baseAddrStr as converted into an actual unsigned value. More... | |
boost::uint32_t | m_bandwidthTestDepth |
The depth of read/write used in bandwidth tests. More... | |
bool | m_verbose |
Verbosity true/false flag. More... | |
bool | m_perIterationDispatch |
Perform a network dispatch every iteration flag. More... | |
bool | m_includeConnect |
Include (e.g. TCP) connect time in reported bandwidth/latency. More... | |
Definition at line 58 of file PerfTester.hxx.
|
private |
Typedef for a ClientInterface shared_ptr.
Definition at line 101 of file PerfTester.hxx.
|
private |
Typedef for a vector of raw client interfaces.
Definition at line 104 of file PerfTester.hxx.
|
private |
Function pointer typedef to a test function.
Definition at line 92 of file PerfTester.hxx.
|
private |
A vector of strings.
Definition at line 89 of file PerfTester.hxx.
|
private |
Typedef for a map that links the name of a test to its description.
Definition at line 98 of file PerfTester.hxx.
|
private |
Typedef for a map that links the name of a test to the function that performs it.
Definition at line 95 of file PerfTester.hxx.
|
private |
An unsigned 32-bit word.
Definition at line 80 of file PerfTester.hxx.
|
private |
A Validated Vector of U32.
Definition at line 86 of file PerfTester.hxx.
|
private |
A vector of unsigned 32-bit words.
Definition at line 83 of file PerfTester.hxx.
PerfTester::PerfTester | ( | ) |
Constructor - takes no arguments, does nothing.
Definition at line 61 of file PerfTester.cxx.
References bandwidthRxTest(), bandwidthTxTest(), m_testDescMap, m_testFuncMap, sandbox(), and validationTest().
|
inline |
Destructor.
Definition at line 66 of file PerfTester.hxx.
|
private |
Returns true if the user has entered bad command line arguments.
Definition at line 211 of file PerfTester.cxx.
|
private |
Read bandwidth test.
Definition at line 296 of file PerfTester.cxx.
References uhal::tests::measureReadLatency(), and uhal::defs::NON_INCREMENTAL.
Referenced by PerfTester().
|
private |
Write bandwidth test.
Definition at line 323 of file PerfTester.cxx.
References uhal::tests::measureWriteLatency(), and uhal::defs::NON_INCREMENTAL.
Referenced by PerfTester().
|
private |
Compares a write buffer with one or more ValVec read responses.
Definition at line 288 of file PerfTester.cxx.
References uhal::ValVector< T >::begin(), and uhal::ValVector< T >::end().
|
private |
Constructs and sets up the appropriate IPbusClient for use in the test.
Definition at line 249 of file PerfTester.cxx.
References uhal::Debug, uhal::ClientFactory::getInstance(), uhal::setLogLevelTo(), and uhal::Warning.
|
staticprivate |
Returns a random uint32_t in the range [0,maxSize], with 1/x probability distribution – so that p(x=0) = p(2<=x<4) = p(2^n <= x < 2^n+1)
Definition at line 60 of file PerfTester_static.cpp.
References uhal::Integer(), uhal::log(), and uhal::Warning.
|
staticprivate |
Returns a buffer of random numbers.
Definition at line 82 of file PerfTester_static.cpp.
|
private |
Outputs the standard help text to screen.
Definition at line 181 of file PerfTester.cxx.
|
private |
Outputs a standard result set to screen - provide it with the number of seconds the test took.
Definition at line 275 of file PerfTester.cxx.
|
private |
Outputs the test names and descriptions to screen.
Definition at line 195 of file PerfTester.cxx.
|
private |
Outputs the user's choices to screen.
Definition at line 230 of file PerfTester.cxx.
int PerfTester::run | ( | int | argc, |
char * | argv[] | ||
) |
Pass in the two command-line parameter variables, this will define the test that then gets run.
Returns 0 if a test was run, or non-zero if something was wrong with the command-line arguments, etc.
Definition at line 94 of file PerfTester.cxx.
References uhal::hex.
Referenced by main().
|
static |
Definition at line 315 of file PerfTester_static.cpp.
References uhal::tests::addr, uhal::ValVector< T >::begin(), uhal::tests::client, uhal::ClientInterface::dispatch(), uhal::Error, uhal::fixed, uhal::defs::INCREMENTAL, uhal::Integer(), uhal::log(), uhal::Notice, uhal::ValVector< T >::push_back(), uhal::Quote(), uhal::ClientInterface::readBlock(), uhal::ClientInterface::rmw_bits(), uhal::ClientInterface::rmw_sum(), uhal::ClientInterface::uri(), and uhal::ClientInterface::writeBlock().
|
private |
An area for a user-definable test.
Definition at line 361 of file PerfTester.cxx.
References uhal::dec, uhal::hex, and uhal::ValWord< T >::value().
Referenced by PerfTester().
|
staticprivate |
Validation test – block write/read-back.
Definition at line 139 of file PerfTester_static.cpp.
References uhal::tests::addr, uhal::ValVector< T >::begin(), uhal::tests::c, uhal::dec, uhal::ClientInterface::dispatch(), uhal::ValVector< T >::end(), uhal::hex, uhal::log(), setupTemplate::name, uhal::Notice, uhal::ClientInterface::readBlock(), uhal::ClientInterface::writeBlock(), and uhal::tests::xx.
|
staticprivate |
Validation test – single-register write/read-back.
Definition at line 98 of file PerfTester_static.cpp.
References uhal::tests::addr, uhal::tests::c, uhal::dec, uhal::ClientInterface::dispatch(), uhal::hex, setupTemplate::name, uhal::ClientInterface::read(), uhal::tests::reg, uhal::ValWord< T >::value(), uhal::ClientInterface::write(), and uhal::tests::x.
|
staticprivate |
Validation test – write, RMW bits, read.
Definition at line 195 of file PerfTester_static.cpp.
References uhal::tests::addr, uhal::tests::c, uhal::dec, uhal::ClientInterface::dispatch(), uhal::hex, setupTemplate::name, uhal::ClientInterface::read(), uhal::ClientInterface::rmw_bits(), uhal::ClientInterface::uri(), uhal::ValWord< T >::value(), and uhal::ClientInterface::write().
|
staticprivate |
Validation test – write, RMW sum, read.
Definition at line 256 of file PerfTester_static.cpp.
References uhal::tests::addr, uhal::tests::c, uhal::dec, uhal::ClientInterface::dispatch(), uhal::hex, setupTemplate::name, uhal::ClientInterface::read(), uhal::ClientInterface::rmw_sum(), uhal::ClientInterface::uri(), uhal::ValWord< T >::value(), and uhal::ClientInterface::write().
|
private |
Historic basic firmware/software validation test.
Definition at line 350 of file PerfTester.cxx.
Referenced by PerfTester().
|
private |
The depth of read/write used in bandwidth tests.
Definition at line 117 of file PerfTester.hxx.
|
private |
The m_baseAddrStr as converted into an actual unsigned value.
Definition at line 116 of file PerfTester.hxx.
|
private |
Base addr of reg/ram the test will use. Use a string as workaround for hex input via boost::program_options.
Definition at line 115 of file PerfTester.hxx.
|
private |
Vector of low-level uHAL clients.
Definition at line 112 of file PerfTester.hxx.
|
private |
Vector of individual connection URI strings.
Definition at line 111 of file PerfTester.hxx.
|
private |
Include (e.g. TCP) connect time in reported bandwidth/latency.
Definition at line 120 of file PerfTester.hxx.
|
private |
Number of test iterations.
Definition at line 114 of file PerfTester.hxx.
|
private |
Perform a network dispatch every iteration flag.
Definition at line 119 of file PerfTester.hxx.
|
private |
Maps test name to test description.
Definition at line 109 of file PerfTester.hxx.
Referenced by PerfTester().
|
private |
Maps test name to test function.
Definition at line 110 of file PerfTester.hxx.
Referenced by PerfTester().
|
private |
Holds the test name.
Definition at line 113 of file PerfTester.hxx.
|
private |
Verbosity true/false flag.
Definition at line 118 of file PerfTester.hxx.