62 p_timeBegin[threadIndex] = phoenix_hardware_rdtsc();
69 size_t elapsedTime = phoenix_hardware_rdtsc() -
p_timeBegin[threadIndex];
70 double dTime = elapsedTime;
104 for(
typename std::vector<T>::const_iterator it(vec.begin()); it != vec.end(); ++it){
118void PFunctionPerf::getPerf(
size_t & nbCall,
double & fullTime,
double & averageTime,
double & stdTime,
size_t & minTime,
size_t & maxTime)
const{
122 averageTime = fullTime/((double)nbCall);
147 double fullTime(0.0), averageTime(0.0), stdTime(0.0);
148 size_t minTime(0lu), maxTime(0lu);
149 getPerf(nbCall, fullTime, averageTime, stdTime, minTime, maxTime);
150 out <<
"Function "<<
p_name<<
"(nbCall = " << nbCall <<
", fullTime = " << fullTime <<
" cy, averageTime = " << averageTime <<
" cy, stdTime = " << stdTime <<
" cy, minTime = " << minTime <<
" cy, maxTime = " << maxTime <<
" cy)" << std::endl;
158 double fullTime(0.0), averageTime(0.0), stdTime(0.0);
159 size_t minTime(0lu), maxTime(0lu);
160 getPerf(nbCall, fullTime, averageTime, stdTime, minTime, maxTime);
161 out <<
p_name<<
"," << nbCall <<
"," << fullTime <<
"," << averageTime <<
"," << stdTime <<
"," << minTime <<
"," << maxTime << std::endl;
T reduceVectorVale(const std::vector< T > &vec)
Sum the given vector.
void resize(size_t nbThread)
Resize the PFunctionPerf by respect to the number of thread which call the function.
PFunctionPerf & operator=(const PFunctionPerf &other)
Definition of equal operator of PFunctionPerf.
void stop(size_t threadIndex=0lu)
Stop the timing of one function.
std::string p_name
Name of the function to profile.
void printCsv(std::ostream &out=std::cout) const
Print the performance of the function in CSV format.
void print(std::ostream &out=std::cout) const
Print the performance of the function.
void copyPFunctionPerf(const PFunctionPerf &other)
Copy function of PFunctionPerf.
virtual ~PFunctionPerf()
Destructor of PFunctionPerf.
void setName(const std::string &name)
Set the name of the function profiled by the current PFunctionPerf.
PFunctionPerf(const std::string &name="")
Default constructor of PFunctionPerf.
std::vector< double > p_fullTime
Full time of execution for the current function (compute the averaged time with nbCall)
std::vector< size_t > p_maxTime
Maximum execution time.
void getPerf(size_t &nbCall, double &fullTime, double &averageTime, double &stdTime, size_t &minTime, size_t &maxTime) const
Get the performances of the current function.
std::vector< double > p_fullSqrTime
Sum of all square times (used to compute standard deviation)
void start(size_t threadIndex=0lu)
Start the timing for one function.
std::vector< size_t > p_nbCall
Number of calls of the current function.
const std::string & getName() const
Get the name of the function to profile.
void initialisationPFunctionPerf(const std::string &name)
Initialisation function of the class PFunctionPerf.
std::vector< size_t > p_minTime
Minimum execution time.
std::vector< size_t > p_timeBegin
Begin time of the current performance evaluation.
void reset()
Reset the profiling.