μHAL (v2.7.9)
Part of the IPbus software repository
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
uhal::tests::PerfTester Class Reference

#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< U32U32Vec
 A vector of unsigned 32-bit words. More...
 
typedef uhal::ValVector< U32U32ValVec
 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, PtrToTestFuncTestFuncMap
 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::ClientInterfaceClientPtr
 Typedef for a ClientInterface shared_ptr. More...
 
typedef std::vector< ClientPtrClientVec
 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...
 

Detailed Description

Definition at line 58 of file PerfTester.hxx.

Member Typedef Documentation

◆ ClientPtr

Typedef for a ClientInterface shared_ptr.

Definition at line 101 of file PerfTester.hxx.

◆ ClientVec

typedef std::vector< ClientPtr > uhal::tests::PerfTester::ClientVec
private

Typedef for a vector of raw client interfaces.

Definition at line 104 of file PerfTester.hxx.

◆ PtrToTestFunc

typedef void( PerfTester::* uhal::tests::PerfTester::PtrToTestFunc) ()
private

Function pointer typedef to a test function.

Definition at line 92 of file PerfTester.hxx.

◆ StringVec

typedef std::vector< std::string > uhal::tests::PerfTester::StringVec
private

A vector of strings.

Definition at line 89 of file PerfTester.hxx.

◆ TestDescMap

typedef std::map<std::string, std::string> uhal::tests::PerfTester::TestDescMap
private

Typedef for a map that links the name of a test to its description.

Definition at line 98 of file PerfTester.hxx.

◆ TestFuncMap

typedef std::map<std::string, PtrToTestFunc> uhal::tests::PerfTester::TestFuncMap
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.

◆ U32

typedef uint32_t uhal::tests::PerfTester::U32
private

An unsigned 32-bit word.

Definition at line 80 of file PerfTester.hxx.

◆ U32ValVec

A Validated Vector of U32.

Definition at line 86 of file PerfTester.hxx.

◆ U32Vec

typedef std::vector< U32 > uhal::tests::PerfTester::U32Vec
private

A vector of unsigned 32-bit words.

Definition at line 83 of file PerfTester.hxx.

Constructor & Destructor Documentation

◆ PerfTester()

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().

◆ ~PerfTester()

uhal::tests::PerfTester::~PerfTester ( )
inline

Destructor.

Definition at line 66 of file PerfTester.hxx.

Member Function Documentation

◆ badInput()

bool PerfTester::badInput ( ) const
private

Returns true if the user has entered bad command line arguments.

Definition at line 211 of file PerfTester.cxx.

◆ bandwidthRxTest()

void PerfTester::bandwidthRxTest ( )
private

Read bandwidth test.

Definition at line 296 of file PerfTester.cxx.

References uhal::tests::measureReadLatency(), and uhal::defs::NON_INCREMENTAL.

Referenced by PerfTester().

◆ bandwidthTxTest()

void PerfTester::bandwidthTxTest ( )
private

Write bandwidth test.

Definition at line 323 of file PerfTester.cxx.

References uhal::tests::measureWriteLatency(), and uhal::defs::NON_INCREMENTAL.

Referenced by PerfTester().

◆ buffersEqual()

bool PerfTester::buffersEqual ( const U32Vec writeBuffer,
const U32ValVec readBuffer 
) const
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().

◆ buildClients()

void PerfTester::buildClients ( )
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.

◆ getRandomBlockSize()

uint32_t PerfTester::getRandomBlockSize ( const uint32_t  maxSize)
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.

◆ getRandomBuffer()

uhal::tests::PerfTester::U32Vec PerfTester::getRandomBuffer ( unsigned  size)
staticprivate

Returns a buffer of random numbers.

Definition at line 82 of file PerfTester_static.cpp.

◆ outputHelpText()

void PerfTester::outputHelpText ( const std::string &  argDescriptions) const
private

Outputs the standard help text to screen.

Definition at line 181 of file PerfTester.cxx.

◆ outputStandardResults()

void PerfTester::outputStandardResults ( double  totalSeconds) const
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.

◆ outputTestDescriptionsList()

void PerfTester::outputTestDescriptionsList ( ) const
private

Outputs the test names and descriptions to screen.

Definition at line 195 of file PerfTester.cxx.

◆ outputUserChoices()

void PerfTester::outputUserChoices ( ) const
private

Outputs the user's choices to screen.

Definition at line 230 of file PerfTester.cxx.

References uhal::dec, and uhal::hex.

◆ run()

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().

◆ runValidationTest()

bool PerfTester::runValidationTest ( const std::vector< ClientInterface * > &  aClients,
const uint32_t  aBaseAddr,
const uint32_t  aDepth,
const size_t  aNrIterations,
const bool  aDispatchEachIteration,
const bool  aVerbose 
)
static

◆ sandbox()

void PerfTester::sandbox ( )
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().

◆ validation_test_block_write_read()

bool PerfTester::validation_test_block_write_read ( uhal::ClientInterface c,
const uint32_t  addr,
const uint32_t  depth,
const bool  perTransactionDispatch,
const bool  aVerbose 
)
staticprivate

◆ validation_test_single_write_read()

bool PerfTester::validation_test_single_write_read ( uhal::ClientInterface c,
const uint32_t  addr,
const bool  perTransactionDispatch,
const bool  aVerbose 
)
staticprivate

◆ validation_test_write_rmwbits_read()

bool PerfTester::validation_test_write_rmwbits_read ( uhal::ClientInterface c,
const uint32_t  addr,
const bool  perTransactionDispatch,
const bool  aVerbose 
)
staticprivate

◆ validation_test_write_rmwsum_read()

bool PerfTester::validation_test_write_rmwsum_read ( uhal::ClientInterface c,
const uint32_t  addr,
const bool  perTransactionDispatch,
const bool  aVerbose 
)
staticprivate

◆ validationTest()

void PerfTester::validationTest ( )
private

Historic basic firmware/software validation test.

Definition at line 350 of file PerfTester.cxx.

Referenced by PerfTester().

Member Data Documentation

◆ m_bandwidthTestDepth

boost::uint32_t uhal::tests::PerfTester::m_bandwidthTestDepth
private

The depth of read/write used in bandwidth tests.

Definition at line 117 of file PerfTester.hxx.

◆ m_baseAddr

boost::uint32_t uhal::tests::PerfTester::m_baseAddr
private

The m_baseAddrStr as converted into an actual unsigned value.

Definition at line 116 of file PerfTester.hxx.

◆ m_baseAddrStr

std::string uhal::tests::PerfTester::m_baseAddrStr
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.

◆ m_clients

ClientVec uhal::tests::PerfTester::m_clients
private

Vector of low-level uHAL clients.

Definition at line 112 of file PerfTester.hxx.

◆ m_deviceURIs

StringVec uhal::tests::PerfTester::m_deviceURIs
private

Vector of individual connection URI strings.

Definition at line 111 of file PerfTester.hxx.

◆ m_includeConnect

bool uhal::tests::PerfTester::m_includeConnect
private

Include (e.g. TCP) connect time in reported bandwidth/latency.

Definition at line 120 of file PerfTester.hxx.

◆ m_iterations

uint64_t uhal::tests::PerfTester::m_iterations
private

Number of test iterations.

Definition at line 114 of file PerfTester.hxx.

◆ m_perIterationDispatch

bool uhal::tests::PerfTester::m_perIterationDispatch
private

Perform a network dispatch every iteration flag.

Definition at line 119 of file PerfTester.hxx.

◆ m_testDescMap

TestDescMap uhal::tests::PerfTester::m_testDescMap
private

Maps test name to test description.

Definition at line 109 of file PerfTester.hxx.

Referenced by PerfTester().

◆ m_testFuncMap

TestFuncMap uhal::tests::PerfTester::m_testFuncMap
private

Maps test name to test function.

Definition at line 110 of file PerfTester.hxx.

Referenced by PerfTester().

◆ m_testName

std::string uhal::tests::PerfTester::m_testName
private

Holds the test name.

Definition at line 113 of file PerfTester.hxx.

◆ m_verbose

bool uhal::tests::PerfTester::m_verbose
private

Verbosity true/false flag.

Definition at line 118 of file PerfTester.hxx.


The documentation for this class was generated from the following files: