Celero
Public Member Functions | Public Attributes | List of all members
DemoTransformFixture Class Reference

John Farrier More...

Inheritance diagram for DemoTransformFixture:
Inheritance graph
[legend]
Collaboration diagram for DemoTransformFixture:
Collaboration graph
[legend]

Public Member Functions

std::vector< std::shared_ptr< celero::TestFixture::ExperimentValue > > getExperimentValues () const override
 Allows a test fixture to supply values to use for experiments. More...
 
void setUp (const celero::TestFixture::ExperimentValue *const experimentValue) override
 Before each run, build a vector of random integers.
 
void tearDown () override
 After each run, clear the vector of random integers.
 
- Public Member Functions inherited from celero::TestFixture
 TestFixture ()
 Default Constructor.
 
virtual ~TestFixture ()
 Virtual destructor for inheritance.
 
virtual double getExperimentValueResultScale () const
 Provide a units result scale of each experiment value. More...
 
virtual void onExperimentStart (const celero::TestFixture::ExperimentValue *const x)
 Allows the text fixture to run code that will be executed once immediately before the benchmark. More...
 
virtual void onExperimentEnd ()
 Allows the text fixture to run code that will be executed once immediately after the benchmark. More...
 
void setExperimentTime (uint64_t x)
 Internal to Celero.
 
uint64_t getExperimentTime () const
 Valid inside tearDown().
 
void setExperimentIterations (uint64_t x)
 Internal to Celero.
 
uint64_t getExperimentIterations () const
 Valid inside tearDown().
 
virtual uint64_t run (uint64_t threads, uint64_t iterations, const celero::TestFixture::ExperimentValue *const experimentValue)
 
virtual std::vector< std::shared_ptr< UserDefinedMeasurement > > getUserDefinedMeasurements () const
 If you want to use user-defined measurements, override this method to return them. More...
 
std::vector< std::string > getUserDefinedMeasurementNames () const
 Returns the names of all user-defined measurements in this fixture.
 

Public Attributes

std::vector< int > arrayIn
 
std::vector< int > arrayOut
 
int arraySize {0}
 

Additional Inherited Members

- Public Types inherited from celero::TestFixture
enum  Constants : int64_t { NoProblemSpaceValue = std::numeric_limits<int64_t>::min() }
 
- Protected Member Functions inherited from celero::TestFixture
virtual void UserBenchmark ()
 Executed for each operation the benchmarking test is run.
 
virtual uint64_t HardCodedMeasurement () const
 Only used for baseline cases. More...
 

Detailed Description

John Farrier

A Celero Test Fixture for array transforms.

This test fixture will build a experiment of powers of two. When executed, the selected experiment is used to create an array of the given size, then push random integers into the array. Each transform function will then modify the randomly generated array for timing.

This demo highlights how to use the ExperimentValues to build automatic test cases which can scale. These test cases should ideally be written to a file when executed. The resulting CSV file can be easily plotted in an application such as Microsoft Excel to show how various tests performed as their experiment scaled.

celeroDemo outfile.csv

Member Function Documentation

◆ getExperimentValues()

std::vector<std::shared_ptr<celero::TestFixture::ExperimentValue> > DemoTransformFixture::getExperimentValues ( ) const
inlineoverridevirtual

Allows a test fixture to supply values to use for experiments.

This is used to create multiple runs of the same experiment and varrying the data set size, for example. The second value of the pair is an optional override for the number of iterations to be used. If zero is specified, then the default number of iterations is used.

It is only guaranteed that the constructor is called prior to this function being called.

Reimplemented from celero::TestFixture.


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