Qt 4.8
Public Functions | Public Variables | Static Public Variables | List of all members
QBenchmarkTestMethodData Class Reference

#include <qbenchmark_p.h>

Public Functions

int adjustIterationCount (int suggestion)
 
void beginDataRun ()
 
void endDataRun ()
 
bool isBenchmark () const
 
 QBenchmarkTestMethodData ()
 
bool resultsAccepted () const
 
void setResult (qreal value, QTest::QBenchmarkMetric metric, bool setByMacro=true)
 
 ~QBenchmarkTestMethodData ()
 

Public Variables

int iterationCount
 
QBenchmarkResult result
 
bool resultAccepted
 
bool runOnce
 

Static Public Variables

static QBenchmarkTestMethodDatacurrent
 

Detailed Description

Definition at line 164 of file qbenchmark_p.h.

Constructors and Destructors

◆ QBenchmarkTestMethodData()

QBenchmarkTestMethodData::QBenchmarkTestMethodData ( )

Definition at line 119 of file qbenchmark.cpp.

120 :resultAccepted(false), runOnce(false), iterationCount(-1)
121 {
122 
123 }

◆ ~QBenchmarkTestMethodData()

QBenchmarkTestMethodData::~QBenchmarkTestMethodData ( )

Definition at line 125 of file qbenchmark.cpp.

126 {
128 }
static QBenchmarkTestMethodData * current
Definition: qbenchmark_p.h:167

Functions

◆ adjustIterationCount()

int QBenchmarkTestMethodData::adjustIterationCount ( int  suggestion)

Definition at line 140 of file qbenchmark.cpp.

Referenced by beginDataRun(), and QTest::setIterationCountHint().

141 {
142  // Let the -iterations option override the measurer.
145  } else {
147  }
148 
149  return iterationCount;
150 }
static QBenchmarkGlobalData * current
Definition: qbenchmark_p.h:136
QBenchmarkMeasurerBase * measurer
Definition: qbenchmark_p.h:146
virtual int adjustIterationCount(int suggestion)=0

◆ beginDataRun()

void QBenchmarkTestMethodData::beginDataRun ( )

Definition at line 130 of file qbenchmark.cpp.

Referenced by QTest::qInvokeTestMethodDataEntry().

131 {
133 }
int adjustIterationCount(int suggestion)
Definition: qbenchmark.cpp:140

◆ endDataRun()

void QBenchmarkTestMethodData::endDataRun ( )

Definition at line 135 of file qbenchmark.cpp.

Referenced by QTest::qInvokeTestMethodDataEntry().

136 {
137 
138 }

◆ isBenchmark()

bool QBenchmarkTestMethodData::isBenchmark ( ) const
inline

Definition at line 176 of file qbenchmark_p.h.

176 { return result.valid; }
QBenchmarkResult result
Definition: qbenchmark_p.h:181

◆ resultsAccepted()

bool QBenchmarkTestMethodData::resultsAccepted ( ) const
inline

Definition at line 177 of file qbenchmark_p.h.

177 { return resultAccepted; }

◆ setResult()

void QBenchmarkTestMethodData::setResult ( qreal  value,
QTest::QBenchmarkMetric  metric,
bool  setByMacro = true 
)

Definition at line 152 of file qbenchmark.cpp.

Referenced by QTest::setBenchmarkResult(), and QTest::QBenchmarkIterationController::~QBenchmarkIterationController().

154 {
155  bool accepted = false;
156 
157  // Always accept the result if the iteration count has been
158  // specified on the command line with -iterations.
160  accepted = true;
161 
162  else if (QBenchmarkTestMethodData::current->runOnce || !setByMacro) {
163  iterationCount = 1;
164  accepted = true;
165  }
166 
167  // Test the result directly without calling the measurer if the minimum time
168  // has been specified on the command line with -minimumvalue.
169  else if (QBenchmarkGlobalData::current->walltimeMinimum != -1)
170  accepted = (value > QBenchmarkGlobalData::current->walltimeMinimum);
171  else
173 
174  // Accept the result or double the number of iterations.
175  if (accepted)
176  resultAccepted = true;
177  else
178  iterationCount *= 2;
179 
180  this->result = QBenchmarkResult(
181  QBenchmarkGlobalData::current->context, value, iterationCount, metric, setByMacro);
182 }
static QBenchmarkGlobalData * current
Definition: qbenchmark_p.h:136
QBenchmarkResult result
Definition: qbenchmark_p.h:181
QBenchmarkMeasurerBase * measurer
Definition: qbenchmark_p.h:146
virtual bool isMeasurementAccepted(qint64 measurement)=0
static QBenchmarkTestMethodData * current
Definition: qbenchmark_p.h:167

Properties

◆ current

QBenchmarkTestMethodData * QBenchmarkTestMethodData::current
static

◆ iterationCount

int QBenchmarkTestMethodData::iterationCount

◆ result

QBenchmarkResult QBenchmarkTestMethodData::result

◆ resultAccepted

bool QBenchmarkTestMethodData::resultAccepted

◆ runOnce

bool QBenchmarkTestMethodData::runOnce

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