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

This is the main(int argc, char** argv) for the entire celero program. More...

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

Classes

class  CopyCountUDM
 
class  RandomUDM
 Used for debugging multiple UDM's. More...
 

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 sample, build a vector of random integers.
 
void onExperimentStart (const celero::TestFixture::ExperimentValue *const) override
 Allows the text fixture to run code that will be executed once immediately before the benchmark. More...
 
void onExperimentEnd () override
 Allows the text fixture to run code that will be executed once immediately after the benchmark. More...
 
void tearDown () override
 Called after test completion to destroy the fixture. More...
 
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 sample, build a vector of random integers.
 
void onExperimentStart (const celero::TestFixture::ExperimentValue *const) override
 Allows the text fixture to run code that will be executed once immediately before the benchmark. More...
 
void tearDown () override
 Called after test completion to destroy the fixture. More...
 
void onExperimentEnd () override
 Allows the text fixture to run code that will be executed once immediately after the benchmark. More...
 
std::vector< std::shared_ptr< celero::UserDefinedMeasurement > > getUserDefinedMeasurements () const override
 If you want to use user-defined measurements, override this method to return them. More...
 
- 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...
 
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)
 
std::vector< std::string > getUserDefinedMeasurementNames () const
 Returns the names of all user-defined measurements in this fixture.
 

Public Attributes

std::vector< int64_t > array
 
int64_t arraySize {0}
 
std::vector< CopyCountingIntarray
 
std::shared_ptr< CopyCountUDMcopyCountUDM {new CopyCountUDM}
 
std::shared_ptr< RandomUDMrandomUDM {new RandomUDM}
 

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

This is the main(int argc, char** argv) for the entire celero program.

John Farrier

You can write your own, or use this macro to insert the standard one into the project.

John Farrier

A Celero Test Fixture for sorting functions.

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 sorting function will then sort 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.

celeroExperimentSortingRandomInts --outputTable quicksort.csv

A Celero Test Fixture for sorting functions.

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 sorting function will then sort 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.

celeroExperimentSortingRandomIntsUDM --outputTable udm.csv

Member Function Documentation

◆ getExperimentValues() [1/2]

std::vector<std::shared_ptr<celero::TestFixture::ExperimentValue> > SortFixture::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.

◆ getExperimentValues() [2/2]

std::vector<std::shared_ptr<celero::TestFixture::ExperimentValue> > SortFixture::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.

◆ getUserDefinedMeasurements()

std::vector<std::shared_ptr<celero::UserDefinedMeasurement> > SortFixture::getUserDefinedMeasurements ( ) const
inlineoverridevirtual

If you want to use user-defined measurements, override this method to return them.

This method must return a vector of pointers, one per type of user-defined measurement that you want to measure.

Reimplemented from celero::TestFixture.

◆ onExperimentEnd() [1/2]

void SortFixture::onExperimentEnd ( )
inlineoverridevirtual

Allows the text fixture to run code that will be executed once immediately after the benchmark.

Unlike tearDown, the evaluation of this function IS included in the total experiment execution time.

After each iteration, clear the vector of random integers.

Reimplemented from celero::TestFixture.

◆ onExperimentEnd() [2/2]

void SortFixture::onExperimentEnd ( )
inlineoverridevirtual

Allows the text fixture to run code that will be executed once immediately after the benchmark.

Unlike tearDown, the evaluation of this function IS included in the total experiment execution time.

After each iteration, clear the vector of random integers.

Reimplemented from celero::TestFixture.

◆ onExperimentStart() [1/2]

void SortFixture::onExperimentStart ( const celero::TestFixture::ExperimentValue x)
inlineoverridevirtual

Allows the text fixture to run code that will be executed once immediately before the benchmark.

Unlike setUp, the evaluation of this function IS included in the total experiment execution time.

Parameters
xThe value for the experiment. This can be ignored if the test does not utilize experiment values.

Reimplemented from celero::TestFixture.

◆ onExperimentStart() [2/2]

void SortFixture::onExperimentStart ( const celero::TestFixture::ExperimentValue x)
inlineoverridevirtual

Allows the text fixture to run code that will be executed once immediately before the benchmark.

Unlike setUp, the evaluation of this function IS included in the total experiment execution time.

Parameters
xThe value for the experiment. This can be ignored if the test does not utilize experiment values.

Reimplemented from celero::TestFixture.

◆ tearDown() [1/2]

void SortFixture::tearDown ( )
inlineoverridevirtual

Called after test completion to destroy the fixture.

This code is NOT included in the benchmark timing. It is executed once after all iterations are executed and between each Sample. Your experiment should NOT rely on "tearDown" methods to be called after EACH experiment run, only between each sample.

Reimplemented from celero::TestFixture.

◆ tearDown() [2/2]

void SortFixture::tearDown ( )
inlineoverridevirtual

Called after test completion to destroy the fixture.

This code is NOT included in the benchmark timing. It is executed once after all iterations are executed and between each Sample. Your experiment should NOT rely on "tearDown" methods to be called after EACH experiment run, only between each sample.

Reimplemented from celero::TestFixture.


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