64void phoenix_vectorToToml(std::ofstream & fs,
const std::vector<double> & vecValue,
const std::string & tableName,
double nbElement){
65 std::string comma(
"");
66 fs << tableName <<
" = [" << std::endl;
67 for(
double value : vecValue){
68 fs << comma <<
"\t" << value/nbElement;
71 fs <<
"\n]" << std::endl;
80 std::cerr <<
"PFunctionTimer::savePerf : cannot save empty vector in file '"<<fileName<<
"'" << std::endl;
86 std::cerr <<
"PFunctionTimer::savePerf : cannot save file '"<<fileName<<
"'" << std::endl;
89 fs <<
"#Global performances" << std::endl;
90 fs <<
"[Performance]" << std::endl;
94 std::vector<double> orderPerfNs, orderPerfCy;
103 fs <<
"#Detailed performances" << std::endl;
104 fs <<
"[Detail]" << std::endl;
113 [](
double cy,
double ns){
128 std::sort(orderPerfNs.begin(), orderPerfNs.end());
129 std::sort(orderPerfCy.begin(), orderPerfCy.end());
166 const std::string & name,
size_t valueIndex)
const
168 fs <<
"#"<<name<<
" performance in nano seconds" << std::endl;
169 fs << name <<
"_nanosecond = " << orderPerfNs[valueIndex] << std::endl;
170 fs <<
"#Best performance in cycles" << std::endl;
171 fs << name <<
"_cycle = " << orderPerfCy[valueIndex] << std::endl;
173 fs <<
"#"<<name<<
" performance in nano seconds per elements" << std::endl;
174 fs << name <<
"_nanosecond_per_element = " << orderPerfNs[valueIndex]/
p_nbElement << std::endl;
175 fs <<
"#"<<name<<
" performance in cycles per elements" << std::endl;
176 fs << name <<
"_cycle_per_element = " << orderPerfCy[valueIndex]/
p_nbElement << std::endl;
177 fs <<
"#"<<name<<
" performance in Giga Elements per second" << std::endl;
178 fs << name <<
"_giga_element_per_second = " <<
p_nbElement/orderPerfNs[valueIndex] << std::endl;
void phoenix_vectorToToml(std::ofstream &fs, const std::vector< double > &vecValue, const std::string &tableName, double nbElement)
Save a vector of values into a toml stream.
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 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.