PhoenixMicroBenchmark  1.0.1
Toolset for function micro-benchmarking
Loading...
Searching...
No Matches
micro_benchmark_rdtsc.h File Reference
+ Include dependency graph for micro_benchmark_rdtsc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename _Callable, typename... _Args>
void micro_benchmarkRdtsc (double &ellapsedTimeNs, double &ellapsedTimeErrorNs, double &timePerElement, double &timeErrorPerElement, size_t nbTestPerf, size_t nbCallPerTest, size_t nbElement, _Callable &&__f, _Args &&... __args)
 Do the micro benchmarking of a given function and gives performance results in cy.
 
template<typename _Callable, typename... _Args>
void micro_benchmarkRdtsc (double &ellapsedTimeNs, double &ellapsedTimeErrorNs, size_t nbTestPerf, size_t nbCallPerTest, _Callable &&__f, _Args &&... __args)
 Do the micro benchmarking of a given function and gives performance results in cy.
 
template<typename _Callable, typename... _Args>
void micro_benchmarkRdtscPrint (const std::string &testName, size_t nbTestPerf, size_t nbCallPerTest, size_t nbElement, _Callable &&__f, _Args &&... __args)
 Do the micro benchmarking of a given function and gives performance results in cy and print the result.
 

Function Documentation

◆ micro_benchmarkRdtsc() [1/2]

template<typename _Callable, typename... _Args>
void micro_benchmarkRdtsc ( double & ellapsedTimeCy,
double & ellapsedTimeErrorCy,
double & timePerElement,
double & timeErrorPerElement,
size_t nbTestPerf,
size_t nbCallPerTest,
size_t nbElement,
_Callable && __f,
_Args &&... __args )

Do the micro benchmarking of a given function and gives performance results in cy.

Parameters
[out]ellapsedTimeCy: ellapsed time in cy
[out]ellapsedTimeErrorCy: error on the ellapsed time in cy
[out]timePerElement: time per element in cy
[out]timeErrorPerElement: error of time per element in cy
nbTestPerf: number of performance test
nbCallPerTest: number of calls per performance test
nbElement: number of element treated by the function __f
__f: function to be called and benchmarked
__args: parameter of the function to be benchmarked

Definition at line 58 of file micro_benchmark_rdtsc_impl.h.

61{
62 micro_benchmarkRdtsc(ellapsedTimeCy, ellapsedTimeErrorCy, nbTestPerf, nbCallPerTest, __f, __args...);
63 timePerElement = ellapsedTimeCy/((double)nbElement);
64 timeErrorPerElement = ellapsedTimeErrorCy/((double)nbElement);
65}
void micro_benchmarkRdtsc(double &ellapsedTimeCy, double &ellapsedTimeErrorCy, size_t nbTestPerf, size_t nbCallPerTest, _Callable &&__f, _Args &&... __args)
Do the micro benchmarking of a given function and gives performance results in cy.

References micro_benchmarkRdtsc().

+ Here is the call graph for this function:

◆ micro_benchmarkRdtsc() [2/2]

template<typename _Callable, typename... _Args>
void micro_benchmarkRdtsc ( double & ellapsedTimeCy,
double & ellapsedTimeErrorCy,
size_t nbTestPerf,
size_t nbCallPerTest,
_Callable && __f,
_Args &&... __args )

Do the micro benchmarking of a given function and gives performance results in cy.

Parameters
[out]ellapsedTimeCy: ellapsed time in cy
[out]ellapsedTimeErrorCy: error on the ellapsed time in cy
nbTestPerf: number of performance test
nbCallPerTest: number of calls per performance test
__f: function to be called and benchmarked
__args: parameter of the function to be benchmarked

Definition at line 22 of file micro_benchmark_rdtsc_impl.h.

24{
25 VecEllapsedTime vecTimeCy;
26 for(size_t i(0lu); i < nbTestPerf; ++i){
27 //Stating the timer
28 size_t beginTime = phoenix_rdtsc();
29 for(size_t j(0lu); j < nbCallPerTest; ++j){
30 __f(__args...);
31 }
32 //Get the time of the nbCallPerTest calls
33 size_t elapsedTime(phoenix_rdtsc() - beginTime);
34 double fullCy(elapsedTime/((double)nbCallPerTest));
35 vecTimeCy.push_back(fullCy);
36 }
37 MapOrderedTime mapOrderTime;
38 micro_benchmarkVecToMap(mapOrderTime, vecTimeCy);
39 size_t nbValueUsed(vecTimeCy.size()*0.7 + 1lu);
40 if(nbValueUsed > vecTimeCy.size()){
41 nbValueUsed = vecTimeCy.size();
42 }
43 micro_benchmarkComputeTime(ellapsedTimeCy, ellapsedTimeErrorCy, mapOrderTime, nbValueUsed);
44}
void micro_benchmarkVecToMap(MapOrderedTime &mapOrderTime, const VecEllapsedTime &vecTime)
Fill the map of ordered time with the vector.
void micro_benchmarkComputeTime(double &ellapsedTimeNs, double &ellapsedTimeErrorNs, const MapOrderedTime &mapOrderTime, size_t nbValueToBeUsed)
Compute the total computing time and associated error with the given data.
std::map< double, size_t > MapOrderedTime
Map of the ordered ellapsed time.
std::vector< double > VecEllapsedTime
Vector of ellapsed time measurement.

References micro_benchmarkComputeTime(), and micro_benchmarkVecToMap().

Referenced by micro_benchmarkRdtsc(), and micro_benchmarkRdtscPrint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ micro_benchmarkRdtscPrint()

template<typename _Callable, typename... _Args>
void micro_benchmarkRdtscPrint ( const std::string & testName,
size_t nbTestPerf,
size_t nbCallPerTest,
size_t nbElement,
_Callable && __f,
_Args &&... __args )

Do the micro benchmarking of a given function and gives performance results in cy and print the result.

Parameters
testName: name of the performance test
nbTestPerf: number of performance test
nbCallPerTest: number of calls per performance test
nbElement: number of element treated by the function __f
__f: function to be called and benchmarked
__args: parameter of the function to be benchmarked

Definition at line 76 of file micro_benchmark_rdtsc_impl.h.

76 {
77 double ellapsedTimeCy(0.0), ellapsedTimeErrorCy(0.0), timePerElement(0.0), timeErrorPerElement(0.0);
78 micro_benchmarkRdtsc(ellapsedTimeCy, ellapsedTimeErrorCy, timePerElement, timeErrorPerElement, nbTestPerf, nbCallPerTest, nbElement, __f, __args...);
79
80 std::cout << testName << " : nbElement = "<<nbElement<<", timePerElement = " << timePerElement << " cy/el ± "<<timeErrorPerElement<<", elapsedTime = " << ellapsedTimeCy << " cy ± "<<ellapsedTimeErrorCy << std::endl;
81 std::cerr << nbElement << "\t" << timePerElement << "\t" << ellapsedTimeCy << "\t" << timeErrorPerElement << "\t" << ellapsedTimeErrorCy << std::endl;
82}

References micro_benchmarkRdtsc().

+ Here is the call graph for this function: