PhoenixMicroBenchmark  1.3.0
Toolset for function micro-benchmarking
Loading...
Searching...
No Matches
PFunctionTimer.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __PFUNCTIONTIMER_H__
8#define __PFUNCTIONTIMER_H__
9
10#include <vector>
11#include <string>
12#include "phoenix_timer.h"
13
16 public:
17 PFunctionTimer(size_t nbMeasure = 0lu, size_t nbElement = 0lu);
18 PFunctionTimer(const PFunctionTimer & other);
19 virtual ~PFunctionTimer();
21
22 void setNbElement(size_t nbElement);
23 void resize(size_t nbMeasure);
24
25 template<typename _Callable, typename... _Args>
26 void evalPerf(_Callable&& __f, _Args&&... __args);
27
28 bool savePerf(const std::string & fileName) const;
29 void getSortedPerf(std::vector<double> & orderPerfNs, std::vector<double> & orderPerfCy) const;
30
31 size_t getNbElement() const;
32 protected:
33 void copyPFunctionTimer(const PFunctionTimer & other);
34
35 private:
36 void initialisationPFunctionTimer(size_t nbMeasure, size_t nbElement);
37 void saveQuantilePerf(std::ofstream & fs, const std::vector<double> & orderPerfNs, const std::vector<double> & orderPerfCy,
38 const std::string & name, size_t valueIndex) const;
39
42
46 std::vector<double> p_vecEllapsedTimeNs;
48 std::vector<double> p_vecEllapsedTimeCycle;
49};
50
51#include "PFunctionTimer_impl.h"
52
53#endif
54
bool savePerf(const std::string &fileName) const
Save the performance of the function in a file.
size_t p_nbElement
Number of elements the function is computing (supposed to be constant for all the performance tests).
PFunctionTimer & operator=(const PFunctionTimer &other)
Definition of equal operator of PFunctionTimer.
std::vector< double > p_vecEllapsedTimeNs
Ellapsed time of the function in nanoseconds.
virtual ~PFunctionTimer()
Destructor of PFunctionTimer.
PFunctionTimer(size_t nbMeasure=0lu, size_t nbElement=0lu)
Default constructor of 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.
size_t p_nbMeasure
Number of performance measures we want on this function.
void getSortedPerf(std::vector< double > &orderPerfNs, std::vector< double > &orderPerfCy) const
Get the ordered performances.
void resize(size_t nbMeasure)
Resize the number of possible measures.
std::vector< double > p_vecEllapsedTimeCycle
Ellapsed time of the function in cycles.
void copyPFunctionTimer(const PFunctionTimer &other)
Copy function of PFunctionTimer.
void evalPerf(_Callable &&__f, _Args &&... __args)
Method which evaluate performance of the given function.
void initialisationPFunctionTimer(size_t nbMeasure, size_t nbElement)
Initialisation function of the class PFunctionTimer.
void setNbElement(size_t nbElement)
Set the number of elements to consider for the function timing.
size_t getNbElement() const
Get the number of elements computed in the performance test.