rambrain
performanceTest<> Class Template Referenceabstract

Base class for all performance tests which itself does not contain any parameters. More...

#include <performanceTestClasses.h>

Public Member Functions

 performanceTest (const char *name)
 Create a new performance test. More...
 
virtual ~performanceTest ()
 Cleanup. More...
 
virtual void runTests (unsigned int repetitions, const string &path="./")
 Run this performance test with all given parameter variations and handle data collection and plotting. More...
 
virtual void actualTestMethod (tester &test, char **arguments, int &offset, unsigned int argumentscount)=0
 Contains the actual test code. More...
 
virtual string getComment ()=0
 Simple getter. More...
 

Static Public Member Functions

static void runRegisteredTests (unsigned int repetitions, const string &path="./")
 Run all registered (and enabled) performance tests with all given parameter variations for each test. More...
 
static void enableTest (const string &name, bool enabled)
 Enable/Disable a specific test case. More...
 
static void enableAllTests (bool enabled)
 Enable/Disable all known test cases. More...
 
static void unregisterTest (const string &name)
 Completely remove a test case from the setup. More...
 
static void dumpTestInfo ()
 Write infos about all registered test cases to stdout. More...
 
static bool runRespectiveTest (const string &name, tester &myTester, unsigned int repetitions, char **arguments, int &offset, int argumentscount)
 Run a specific test case several times. More...
 
static void setDisplayPlots (bool display)
 If the generated plots shall be immediately displayed. More...
 

Protected Member Functions

virtual unsigned int getStepsForParam (unsigned int varryParam)
 Get the amount of steps for parameter variation. More...
 
virtual string getParamsString (int varryParam, unsigned int step, const string &delimiter=" ")
 Create a string using the current parameter values. More...
 
virtual string getTestOutfile (int varryParam, unsigned int step)
 Creates a string for an outfilename using the current parameter values. More...
 
virtual void resultToTempFile (int varryParam, unsigned int step, ofstream &file)
 Read in average timing results from a test and write the important data to a file. More...
 
virtual vector< string > splitString (const string &in, char delimiter)
 Split a string into a list of substrings. More...
 
virtual string generateGnuplotScript (const string &infile, const string &name, const string &xlabel, const string &ylabel, const string &title, bool log, int paramColumn)
 Generate a gnuplot script for swapstats output plotting. More...
 
virtual void handleTimingInfos (int varryParam, unsigned int step, unsigned int repetitions)
 Handles the timing informations and produces a plot. More...
 
virtual vector< vector< string > > getRelevantTimingParts (ifstream &in, unsigned long long start, unsigned long long end)
 Extract timing information from a file. More...
 
virtual void timingInfosToFile (ofstream &out, const vector< vector< string >> &relevantTimingParts, unsigned long long &starttime)
 Writes timing information to a file. More...
 
virtual void plotTimingInfos (ofstream &gnutemp, const string &outname, const string &dataFile, unsigned int measurements, unsigned int repetitions, bool linesPoints)
 Plot timing information. More...
 
virtual void plotTimingHitMissInfos (ofstream &gnutemp, const string &outname, const string &dataFile, unsigned int measurements, unsigned int repetitions, bool linesPoints)
 Plot timed hit/miss information. More...
 
virtual string generateMyGnuplotPlotPart (const string &file, int paramColumn)=0
 Create a gnuplot script for plotting test results. More...
 

Protected Attributes

const char * name
 
bool enabled = true
 
vector< testParameterBase * > parameters
 
vector< string > plotParts
 
bool plotTimingStats = true
 

Static Protected Attributes

static map< string, performanceTest<> * > testClasses
 
static bool displayPlots
 

Detailed Description

template<>
class performanceTest<>

Base class for all performance tests which itself does not contain any parameters.

Definition at line 145 of file performanceTestClasses.h.

Constructor & Destructor Documentation

performanceTest<>::performanceTest ( const char *  name)

Create a new performance test.

Parameters
nameThe test's name
virtual performanceTest<>::~performanceTest ( )
inlinevirtual

Cleanup.

Definition at line 157 of file performanceTestClasses.h.

Member Function Documentation

virtual void performanceTest<>::actualTestMethod ( tester test,
char **  arguments,
int &  offset,
unsigned int  argumentscount 
)
pure virtual

Contains the actual test code.

Parameters
testThe tester class for timing collection
argumentsThe parameters to pass to the test
offsetAt which index the parameters start in the arguments array; Will be incremented to point behind the parameters
argumentscountHow many parameters
static void performanceTest<>::dumpTestInfo ( )
static

Write infos about all registered test cases to stdout.

static void performanceTest<>::enableAllTests ( bool  enabled)
static

Enable/Disable all known test cases.

Parameters
enabledEnable or disable
static void performanceTest<>::enableTest ( const string &  name,
bool  enabled 
)
static

Enable/Disable a specific test case.

Parameters
nameIt's name
enabledEnable or disable
virtual string performanceTest<>::generateGnuplotScript ( const string &  infile,
const string &  name,
const string &  xlabel,
const string &  ylabel,
const string &  title,
bool  log,
int  paramColumn 
)
protectedvirtual

Generate a gnuplot script for swapstats output plotting.

Parameters
infileName of the file where the data is stored
nameName of the output file
xlabelLabel of the x axis
ylabelLabel of the y axis
titleTitle of the plot
logIf plot shall be in logscale
paramColumnColumn of the temp file to plot
Returns
The gnuplot script
See also
resultToTempFile
virtual string performanceTest<>::generateMyGnuplotPlotPart ( const string &  file,
int  paramColumn 
)
protectedpure virtual

Create a gnuplot script for plotting test results.

Parameters
fileInfile name
paramColumnWhich column to plot as x axis
Returns
The script
virtual string performanceTest<>::getComment ( )
pure virtual

Simple getter.

virtual string performanceTest<>::getParamsString ( int  varryParam,
unsigned int  step,
const string &  delimiter = " " 
)
protectedvirtual

Create a string using the current parameter values.

Parameters
varryParamWhich parameter is stepped through
stepWhich step it is at the moment
delimiterA delimiter between the parts
Returns
The string
virtual vector<vector<string> > performanceTest<>::getRelevantTimingParts ( ifstream &  in,
unsigned long long  start,
unsigned long long  end 
)
protectedvirtual

Extract timing information from a file.

Parameters
inThe file
startStart time
endEnd time
Returns
The relevant data
virtual unsigned int performanceTest<>::getStepsForParam ( unsigned int  varryParam)
inlineprotectedvirtual

Get the amount of steps for parameter variation.

Parameters
varryParamWhich parameter is asked
Returns
The steps

Definition at line 233 of file performanceTestClasses.h.

virtual string performanceTest<>::getTestOutfile ( int  varryParam,
unsigned int  step 
)
protectedvirtual

Creates a string for an outfilename using the current parameter values.

Parameters
varryParamWhich parameter is stepped through
stepWhich step it is at the moment
Returns
The string
virtual void performanceTest<>::handleTimingInfos ( int  varryParam,
unsigned int  step,
unsigned int  repetitions 
)
protectedvirtual

Handles the timing informations and produces a plot.

Parameters
varryParamWhich parameter is stepped through
stepWhich step it is at the moment
repetitionsThe amount of repetitions
virtual void performanceTest<>::plotTimingHitMissInfos ( ofstream &  gnutemp,
const string &  outname,
const string &  dataFile,
unsigned int  measurements,
unsigned int  repetitions,
bool  linesPoints 
)
protectedvirtual

Plot timed hit/miss information.

Parameters
gnutempOutfile for gnuplot script
outnameName of resulting file
dataFileName of data file
measurementsAmount of measurements
repetitionsAmount of repetitions
linesPointsIf points shall be added on top of lines for data points
virtual void performanceTest<>::plotTimingInfos ( ofstream &  gnutemp,
const string &  outname,
const string &  dataFile,
unsigned int  measurements,
unsigned int  repetitions,
bool  linesPoints 
)
protectedvirtual

Plot timing information.

Parameters
gnutempOutfile for gnuplot script
outnameName of resulting file
dataFileName of data file
measurementsAmount of measurements
repetitionsAmount of repetitions
linesPointsIf points shall be added on top of lines for data points
virtual void performanceTest<>::resultToTempFile ( int  varryParam,
unsigned int  step,
ofstream &  file 
)
protectedvirtual

Read in average timing results from a test and write the important data to a file.

Parameters
varryParamWhich parameter is stepped through
stepWhich step it is at the moment
fileThe outfile
static void performanceTest<>::runRegisteredTests ( unsigned int  repetitions,
const string &  path = "./" 
)
static

Run all registered (and enabled) performance tests with all given parameter variations for each test.

Parameters
repetitionsThe amount of repetitions for each test
pathWhere the performancetests binary is
static bool performanceTest<>::runRespectiveTest ( const string &  name,
tester myTester,
unsigned int  repetitions,
char **  arguments,
int &  offset,
int  argumentscount 
)
static

Run a specific test case several times.

Parameters
nameIt's name
myTesterThe tester class for timing collection
repetitionsHow often to repeat the test
argumentsThe parameters to pass to the test
offsetAt which index the parameters start in the arguments array; Will be incremented to point behind the parameters
argumentscountHow many parameters
Returns
Success
virtual void performanceTest<>::runTests ( unsigned int  repetitions,
const string &  path = "./" 
)
virtual

Run this performance test with all given parameter variations and handle data collection and plotting.

Parameters
repetitionsThe amount of repetitions for each test
pathWhere the performancetests binary is
static void performanceTest<>::setDisplayPlots ( bool  display)
inlinestatic

If the generated plots shall be immediately displayed.

Parameters
displayDisplay on or off
Note
Default is false

Definition at line 223 of file performanceTestClasses.h.

virtual vector<string> performanceTest<>::splitString ( const string &  in,
char  delimiter 
)
protectedvirtual

Split a string into a list of substrings.

Parameters
inThe string
delimiterWhich delimiter to use for splitting
Returns
The list
virtual void performanceTest<>::timingInfosToFile ( ofstream &  out,
const vector< vector< string >> &  relevantTimingParts,
unsigned long long &  starttime 
)
protectedvirtual

Writes timing information to a file.

Parameters
outThe file
relevantTimingPartsThe relevant timing data
starttimeStart time; Will be changed to first time in data if zero beforehand
static void performanceTest<>::unregisterTest ( const string &  name)
static

Completely remove a test case from the setup.

Parameters
nameIt's name

Member Data Documentation

bool performanceTest<>::displayPlots
staticprotected

Definition at line 335 of file performanceTestClasses.h.

bool performanceTest<>::enabled = true
protected

Definition at line 331 of file performanceTestClasses.h.

const char* performanceTest<>::name
protected

Definition at line 330 of file performanceTestClasses.h.

vector<testParameterBase *> performanceTest<>::parameters
protected

Definition at line 332 of file performanceTestClasses.h.

vector<string> performanceTest<>::plotParts
protected

Definition at line 334 of file performanceTestClasses.h.

bool performanceTest<>::plotTimingStats = true
protected

Definition at line 336 of file performanceTestClasses.h.

map<string, performanceTest<> *> performanceTest<>::testClasses
staticprotected

Definition at line 333 of file performanceTestClasses.h.


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