![]() |
|
PhoenixMicroBenchmark
1.3.0
Toolset for function micro-benchmarking
|
Timer used to time a function call multiple times. More...
#include <PFunctionTimer.h>
Public Member Functions | |
| template<typename _Callable, typename... _Args> | |
| void | evalPerf (_Callable &&__f, _Args &&... __args) |
| Method which evaluate performance of the given function. | |
| size_t | getNbElement () const |
| Get the number of elements computed in the performance test. | |
| void | getSortedPerf (std::vector< double > &orderPerfNs, std::vector< double > &orderPerfCy) const |
| Get the ordered performances. | |
| PFunctionTimer & | operator= (const PFunctionTimer &other) |
| Definition of equal operator of PFunctionTimer. | |
| PFunctionTimer (const PFunctionTimer &other) | |
| Copy constructor of PFunctionTimer. | |
| PFunctionTimer (size_t nbMeasure=0lu, size_t nbElement=0lu) | |
| Default constructor of PFunctionTimer. | |
| void | resize (size_t nbMeasure) |
| Resize the number of possible measures. | |
| bool | savePerf (const std::string &fileName) const |
| Save the performance of the function in a file. | |
| void | setNbElement (size_t nbElement) |
| Set the number of elements to consider for the function timing. | |
| virtual | ~PFunctionTimer () |
| Destructor of PFunctionTimer. | |
Protected Member Functions | |
| void | copyPFunctionTimer (const PFunctionTimer &other) |
| Copy function of PFunctionTimer. | |
Private Member Functions | |
| void | initialisationPFunctionTimer (size_t nbMeasure, size_t nbElement) |
| Initialisation function of the class PFunctionTimer. | |
| void | saveQuantilePerf (std::ofstream &fs, const std::vector< double > &orderPerfNs, const std::vector< double > &orderPerfCy, const std::string &name, size_t valueIndex) const |
| Save the performance of the given quantile. | |
Private Attributes | |
| size_t | p_nbElement |
| Number of elements the function is computing (supposed to be constant for all the performance tests). | |
| size_t | p_nbMeasure |
| Number of performance measures we want on this function. | |
| std::vector< double > | p_vecEllapsedTimeCycle |
| Ellapsed time of the function in cycles. | |
| std::vector< double > | p_vecEllapsedTimeNs |
| Ellapsed time of the function in nanoseconds. | |
Timer used to time a function call multiple times.
Definition at line 15 of file PFunctionTimer.h.
| PFunctionTimer::PFunctionTimer | ( | size_t | nbMeasure = 0lu, |
| size_t | nbElement = 0lu ) |
Default constructor of PFunctionTimer.
| nbMeasure | : number of performance measures we want on this function |
| nbElement | : number of elements the function is computing (supposed to be constant for all the performance tests) |
Definition at line 17 of file PFunctionTimer.cpp.
References initialisationPFunctionTimer().
Referenced by copyPFunctionTimer(), operator=(), and PFunctionTimer().
| PFunctionTimer::PFunctionTimer | ( | const PFunctionTimer & | other | ) |
Copy constructor of PFunctionTimer.
| other | : class to copy |
Definition at line 24 of file PFunctionTimer.cpp.
References copyPFunctionTimer(), and PFunctionTimer().
|
virtual |
|
protected |
Copy function of PFunctionTimer.
| other | : class to copy |
Definition at line 142 of file PFunctionTimer.cpp.
References p_nbElement, p_nbMeasure, p_vecEllapsedTimeCycle, p_vecEllapsedTimeNs, and PFunctionTimer().
Referenced by operator=(), and PFunctionTimer().
| void PFunctionTimer::evalPerf | ( | _Callable && | __f, |
| _Args &&... | __args ) |
Method which evaluate performance of the given function.
| __f | : function to be evaluated |
| __args | : arguments of the function The function will be called nbMeasure times (set by the resize method) |
Definition at line 33 of file PFunctionTimer_impl.h.
References benchmark_doNotOptimize(), p_nbMeasure, p_vecEllapsedTimeCycle, p_vecEllapsedTimeNs, phoenix_getTime(), phoenix_rdtsc(), and PIN_THREAD_TO_CORE.
| size_t PFunctionTimer::getNbElement | ( | ) | const |
Get the number of elements computed in the performance test.
Definition at line 135 of file PFunctionTimer.cpp.
References p_nbElement.
| void PFunctionTimer::getSortedPerf | ( | std::vector< double > & | orderPerfNs, |
| std::vector< double > & | orderPerfCy ) const |
Get the ordered performances.
| [out] | orderPerfNs | : sorted performance in nanoseconds |
| [out] | orderPerfCy | : sorted performance in cycles |
Definition at line 125 of file PFunctionTimer.cpp.
References p_vecEllapsedTimeCycle, and p_vecEllapsedTimeNs.
Referenced by savePerf().
|
private |
Initialisation function of the class PFunctionTimer.
| nbMeasure | : number of performance measures we want on this function |
| nbElement | : number of elements the function is computing (supposed to be constant for all the performance tests) |
Definition at line 153 of file PFunctionTimer.cpp.
References resize(), and setNbElement().
Referenced by PFunctionTimer().
| PFunctionTimer & PFunctionTimer::operator= | ( | const PFunctionTimer & | other | ) |
Definition of equal operator of PFunctionTimer.
| other | : class to copy |
Definition at line 37 of file PFunctionTimer.cpp.
References copyPFunctionTimer(), and PFunctionTimer().
| void PFunctionTimer::resize | ( | size_t | nbMeasure | ) |
Resize the number of possible measures.
| nbMeasure | : number of performance measures we want on this function |
Definition at line 52 of file PFunctionTimer.cpp.
References p_nbMeasure, p_vecEllapsedTimeCycle, and p_vecEllapsedTimeNs.
Referenced by initialisationPFunctionTimer().
| bool PFunctionTimer::savePerf | ( | const std::string & | fileName | ) | const |
Save the performance of the function in a file.
| fileName | : name of the file to be saved with our function performances |
Definition at line 78 of file PFunctionTimer.cpp.
References getSortedPerf(), p_nbElement, p_nbMeasure, p_vecEllapsedTimeCycle, p_vecEllapsedTimeNs, phoenix_vectorToToml(), and saveQuantilePerf().
|
private |
Save the performance of the given quantile.
| [out] | fs | : stream to be updated |
| orderPerfNs | : ordered performances in nanoseconds | |
| orderPerfCy | : ordered performances in cycles | |
| name | : name of the variable | |
| valueIndex | : index of the value in the tables |
Definition at line 165 of file PFunctionTimer.cpp.
References p_nbElement.
Referenced by savePerf().
| void PFunctionTimer::setNbElement | ( | size_t | nbElement | ) |
Set the number of elements to consider for the function timing.
| nbElement | : number of elements the function is computing (supposed to be constant for all the performance tests) |
Definition at line 45 of file PFunctionTimer.cpp.
References p_nbElement.
Referenced by initialisationPFunctionTimer().
|
private |
Number of elements the function is computing (supposed to be constant for all the performance tests).
Definition at line 44 of file PFunctionTimer.h.
Referenced by copyPFunctionTimer(), getNbElement(), savePerf(), saveQuantilePerf(), and setNbElement().
|
private |
Number of performance measures we want on this function.
Definition at line 41 of file PFunctionTimer.h.
Referenced by copyPFunctionTimer(), evalPerf(), resize(), and savePerf().
|
private |
Ellapsed time of the function in cycles.
Definition at line 48 of file PFunctionTimer.h.
Referenced by copyPFunctionTimer(), evalPerf(), getSortedPerf(), resize(), and savePerf().
|
private |
Ellapsed time of the function in nanoseconds.
Definition at line 46 of file PFunctionTimer.h.
Referenced by copyPFunctionTimer(), evalPerf(), getSortedPerf(), resize(), and savePerf().