|
rambrain
|
A basic class to be used by tests. Provides helper methods and functionality e.g. time measurements. More...
#include <tester.h>
Public Member Functions | |
| tester (const char *name="") | |
| tester Create a new tester More... | |
| ~tester () | |
| Cleans up and destroys the tester. More... | |
| void | addParameter (char *param) |
| Add a new parameter to the list of parameters. More... | |
| void | addTimeMeasurement () |
| Saves the current timestamp. More... | |
| void | addExternalTime (std::chrono::duration< double >) |
| Add a duration to the timing list. More... | |
| void | addComment (const char *comment) |
| Simple setter. More... | |
| void | setSeed (unsigned int seed=time(NULL)) |
| Set a new seed for random number generation. More... | |
| int | random (int max) const |
| Get a random number (integer) More... | |
| uint64_t | random (uint64_t max) const |
| Get a random number (long integer) More... | |
| double | random (double max=1.0) const |
| Get a random number (double) More... | |
| void | startNewTimeCycle () |
| Starts a new cycle of time measurements. More... | |
| void | startNewRNGCycle () |
| Starts a new cycle of random numbers. More... | |
| void | writeToFile () |
| Write all collected information to file. More... | |
| std::vector< int64_t > | getDurationsForCurrentCycle () const |
| Take the current cycle of time measurements and calculate all durations in betwen. More... | |
Private Attributes | |
| const char * | name |
| std::vector< char * > | parameters |
| std::vector< std::vector< std::chrono::high_resolution_clock::time_point > > | timeMeasures |
| std::string | comment |
| std::vector< unsigned int > | seeds |
| std::vector< bool > | seeded |
A basic class to be used by tests. Provides helper methods and functionality e.g. time measurements.
| tester::tester | ( | const char * | name = "" | ) |
tester Create a new tester
| name | Name of the current test |
Definition at line 22 of file tester.cpp.
| tester::~tester | ( | ) |
Cleans up and destroys the tester.
Definition at line 27 of file tester.cpp.
| void tester::addComment | ( | const char * | comment | ) |
Simple setter.
Definition at line 59 of file tester.cpp.
| void tester::addExternalTime | ( | std::chrono::duration< double > | ) |
Add a duration to the timing list.
Definition at line 45 of file tester.cpp.
| void tester::addParameter | ( | char * | param | ) |
Add a new parameter to the list of parameters.
| param | The parameter value |
Definition at line 31 of file tester.cpp.
| void tester::addTimeMeasurement | ( | ) |
Saves the current timestamp.
Definition at line 36 of file tester.cpp.
| std::vector< int64_t > tester::getDurationsForCurrentCycle | ( | ) | const |
Take the current cycle of time measurements and calculate all durations in betwen.
Definition at line 186 of file tester.cpp.
| int tester::random | ( | int | max | ) | const |
Get a random number (integer)
| max | The upper limit for generated random numbers |
Definition at line 74 of file tester.cpp.
| uint64_t tester::random | ( | uint64_t | max | ) | const |
Get a random number (long integer)
| max | The upper limit for generated random numbers |
Definition at line 79 of file tester.cpp.
| double tester::random | ( | double | max = 1.0 | ) | const |
Get a random number (double)
| max | The upper limit for generated random numbers |
Definition at line 84 of file tester.cpp.
| void tester::setSeed | ( | unsigned int | seed = time ( NULL ) | ) |
Set a new seed for random number generation.
| seed | The seed |
Definition at line 64 of file tester.cpp.
| void tester::startNewRNGCycle | ( | ) |
Starts a new cycle of random numbers.
Allows to set a new seed afterwards without loosing the seed information before
Definition at line 94 of file tester.cpp.
| void tester::startNewTimeCycle | ( | ) |
Starts a new cycle of time measurements.
Different cycles are independent. In each cycle durations are measured w.r.t. the last measurement
Definition at line 89 of file tester.cpp.
| void tester::writeToFile | ( | ) |
Write all collected information to file.
The file name consists of the test name followed by a hash seperated list of the parameter values
Definition at line 100 of file tester.cpp.
|
private |