SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Types | Public Member Functions | Private Attributes | List of all members
ParserBench Class Reference

#include <parserbench.h>

Public Types

enum  TestType {
  TestDecimatorsII, TestDecimatorsIF, TestDecimatorsFI, TestDecimatorsFF,
  TestDecimatorsInfII, TestDecimatorsSupII, TestAMBE
}
 

Public Member Functions

 ParserBench ()
 
 ~ParserBench ()
 
void parse (const QCoreApplication &app)
 
const QString & getTestStr () const
 
TestType getTestType () const
 
uint32_t getNbSamples () const
 
uint32_t getRepetition () const
 
uint32_t getLog2Factor () const
 

Private Attributes

QString m_testStr
 
uint32_t m_nbSamples
 
uint32_t m_repetition
 
uint32_t m_log2Factor
 
QCommandLineParser m_parser
 
QCommandLineOption m_testOption
 
QCommandLineOption m_nbSamplesOption
 
QCommandLineOption m_repetitionOption
 
QCommandLineOption m_log2FactorOption
 

Detailed Description

Definition at line 25 of file parserbench.h.

Member Enumeration Documentation

◆ TestType

Enumerator
TestDecimatorsII 
TestDecimatorsIF 
TestDecimatorsFI 
TestDecimatorsFF 
TestDecimatorsInfII 
TestDecimatorsSupII 
TestAMBE 

Definition at line 28 of file parserbench.h.

Constructor & Destructor Documentation

◆ ParserBench()

ParserBench::ParserBench ( )

Definition at line 25 of file parserbench.cpp.

References m_log2Factor, m_log2FactorOption, m_nbSamples, m_nbSamplesOption, m_parser, m_repetition, m_repetitionOption, m_testOption, and m_testStr.

25  :
26  m_testOption(QStringList() << "t" << "test",
27  "Test type: decimateii, decimatefi, decimateff, decimateif, decimateinfii, decimatesupii, ambe",
28  "test",
29  "decimateii"),
30  m_nbSamplesOption(QStringList() << "n" << "nb-samples",
31  "Number of sample to deal with.",
32  "samples",
33  "1048576"),
34  m_repetitionOption(QStringList() << "r" << "repeat",
35  "Number of repetitions.",
36  "repetition",
37  "1"),
38  m_log2FactorOption(QStringList() << "l" << "log2-factor",
39  "Log2 factor for rate conversion.",
40  "log2",
41  "2")
42 {
43  m_testStr = "decimateii";
44  m_nbSamples = 1048576;
45  m_repetition = 1;
46  m_log2Factor = 4;
47 
48  m_parser.setApplicationDescription("Software Defined Radio application benchmarks");
49  m_parser.addHelpOption();
50  m_parser.addVersionOption();
51 
52  m_parser.addOption(m_testOption);
53  m_parser.addOption(m_nbSamplesOption);
54  m_parser.addOption(m_repetitionOption);
55  m_parser.addOption(m_log2FactorOption);
56 }
QCommandLineParser m_parser
Definition: parserbench.h:56
uint32_t m_repetition
Definition: parserbench.h:53
QCommandLineOption m_log2FactorOption
Definition: parserbench.h:60
uint32_t m_log2Factor
Definition: parserbench.h:54
QCommandLineOption m_nbSamplesOption
Definition: parserbench.h:58
QCommandLineOption m_repetitionOption
Definition: parserbench.h:59
QCommandLineOption m_testOption
Definition: parserbench.h:57
uint32_t m_nbSamples
Definition: parserbench.h:52
QString m_testStr
Definition: parserbench.h:51

◆ ~ParserBench()

ParserBench::~ParserBench ( )

Definition at line 58 of file parserbench.cpp.

59 { }

Member Function Documentation

◆ getLog2Factor()

uint32_t ParserBench::getLog2Factor ( ) const
inline

◆ getNbSamples()

uint32_t ParserBench::getNbSamples ( ) const
inline

Definition at line 46 of file parserbench.h.

References m_nbSamples.

Referenced by MainBench::printResults(), MainBench::run(), MainBench::testDecimateFF(), MainBench::testDecimateFI(), MainBench::testDecimateIF(), and MainBench::testDecimateII().

46 { return m_nbSamples; }
uint32_t m_nbSamples
Definition: parserbench.h:52
+ Here is the caller graph for this function:

◆ getRepetition()

uint32_t ParserBench::getRepetition ( ) const
inline

Definition at line 47 of file parserbench.h.

References m_repetition.

Referenced by MainBench::printResults(), MainBench::run(), MainBench::testDecimateFF(), MainBench::testDecimateFI(), MainBench::testDecimateIF(), and MainBench::testDecimateII().

47 { return m_repetition; }
uint32_t m_repetition
Definition: parserbench.h:53
+ Here is the caller graph for this function:

◆ getTestStr()

const QString& ParserBench::getTestStr ( ) const
inline

Definition at line 44 of file parserbench.h.

References getTestType(), and m_testStr.

Referenced by MainBench::run().

44 { return m_testStr; }
QString m_testStr
Definition: parserbench.h:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestType()

ParserBench::TestType ParserBench::getTestType ( ) const

Definition at line 116 of file parserbench.cpp.

References m_testStr, TestAMBE, TestDecimatorsFF, TestDecimatorsFI, TestDecimatorsIF, TestDecimatorsII, TestDecimatorsInfII, and TestDecimatorsSupII.

Referenced by getTestStr(), and MainBench::run().

117 {
118  if (m_testStr == "decimatefi") {
119  return TestDecimatorsFI;
120  } else if (m_testStr == "decimateff") {
121  return TestDecimatorsFF;
122  } else if (m_testStr == "decimateif") {
123  return TestDecimatorsIF;
124  } else if (m_testStr == "decimateinfii") {
125  return TestDecimatorsInfII;
126  } else if (m_testStr == "decimatesupii") {
127  return TestDecimatorsSupII;
128  } else if (m_testStr == "ambe") {
129  return TestAMBE;
130  } else {
131  return TestDecimatorsII;
132  }
133 }
QString m_testStr
Definition: parserbench.h:51
+ Here is the caller graph for this function:

◆ parse()

void ParserBench::parse ( const QCoreApplication &  app)

Definition at line 61 of file parserbench.cpp.

References m_log2Factor, m_log2FactorOption, m_nbSamples, m_nbSamplesOption, m_parser, m_repetition, m_repetitionOption, m_testOption, and m_testStr.

62 {
63  m_parser.process(app);
64 
65  int pos;
66  bool ok;
67 
68  // test switch
69 
70  QString test = m_parser.value(m_testOption);
71 
72  QString testStr = "([a-z]+)";
73  QRegExp ipRegex ("^" + testStr + "$");
74  QRegExpValidator ipValidator(ipRegex);
75 
76  if (ipValidator.validate(test, pos) == QValidator::Acceptable) {
77  m_testStr = test;
78  } else {
79  qWarning() << "ParserBench::parse: test string invalid. Defaulting to " << m_testStr;
80  }
81 
82  // number of samples
83 
84  QString nbSamplesStr = m_parser.value(m_nbSamplesOption);
85  int nbSamples = nbSamplesStr.toInt(&ok);
86 
87  if (ok && (nbSamples > 1024) && (nbSamples < 1073741824)) {
88  m_nbSamples = nbSamples;
89  } else {
90  qWarning() << "ParserBench::parse: number of samples invalid. Defaulting to " << m_nbSamples;
91  }
92 
93  // repetition
94 
95  QString repetitionStr = m_parser.value(m_repetitionOption);
96  int repetition = repetitionStr.toInt(&ok);
97 
98  if (ok && (repetition >= 0)) {
99  m_repetition = repetition;
100  } else {
101  qWarning() << "ParserBench::parse: repetition invalid. Defaulting to " << m_repetition;
102  }
103 
104  // log2 factor
105 
106  QString log2FactorStr = m_parser.value(m_log2FactorOption);
107  int log2Factor = log2FactorStr.toInt(&ok);
108 
109  if (ok && (log2Factor >= 0) && (log2Factor <= 6)) {
110  m_log2Factor = log2Factor;
111  } else {
112  qWarning() << "ParserBench::parse: repetilog2 factortion invalid. Defaulting to " << m_log2Factor;
113  }
114 }
QCommandLineParser m_parser
Definition: parserbench.h:56
uint32_t m_repetition
Definition: parserbench.h:53
QCommandLineOption m_log2FactorOption
Definition: parserbench.h:60
uint32_t m_log2Factor
Definition: parserbench.h:54
QCommandLineOption m_nbSamplesOption
Definition: parserbench.h:58
QCommandLineOption m_repetitionOption
Definition: parserbench.h:59
QCommandLineOption m_testOption
Definition: parserbench.h:57
uint32_t m_nbSamples
Definition: parserbench.h:52
QString m_testStr
Definition: parserbench.h:51

Member Data Documentation

◆ m_log2Factor

uint32_t ParserBench::m_log2Factor
private

Definition at line 54 of file parserbench.h.

Referenced by getLog2Factor(), parse(), and ParserBench().

◆ m_log2FactorOption

QCommandLineOption ParserBench::m_log2FactorOption
private

Definition at line 60 of file parserbench.h.

Referenced by parse(), and ParserBench().

◆ m_nbSamples

uint32_t ParserBench::m_nbSamples
private

Definition at line 52 of file parserbench.h.

Referenced by getNbSamples(), parse(), and ParserBench().

◆ m_nbSamplesOption

QCommandLineOption ParserBench::m_nbSamplesOption
private

Definition at line 58 of file parserbench.h.

Referenced by parse(), and ParserBench().

◆ m_parser

QCommandLineParser ParserBench::m_parser
private

Definition at line 56 of file parserbench.h.

Referenced by parse(), and ParserBench().

◆ m_repetition

uint32_t ParserBench::m_repetition
private

Definition at line 53 of file parserbench.h.

Referenced by getRepetition(), parse(), and ParserBench().

◆ m_repetitionOption

QCommandLineOption ParserBench::m_repetitionOption
private

Definition at line 59 of file parserbench.h.

Referenced by parse(), and ParserBench().

◆ m_testOption

QCommandLineOption ParserBench::m_testOption
private

Definition at line 57 of file parserbench.h.

Referenced by parse(), and ParserBench().

◆ m_testStr

QString ParserBench::m_testStr
private

Definition at line 51 of file parserbench.h.

Referenced by getTestStr(), getTestType(), parse(), and ParserBench().


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