Measures execution time

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1466 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
wcancino 2009-03-02 15:29:28 +00:00
commit 0a469d1502

View file

@ -17,9 +17,9 @@
#include <vectorSortIndex.h>
#include <utils.h>
#include <ctime>
#include <apply.h>
gsl_rng *rn2;
RandomNr *rn;
//Sequences *seq;
@ -35,7 +35,9 @@ ProbMatrixContainer *probmatrixs_ptr;
int main(int argc, char *argv[])
{
// measures execution time
struct timeval tempo1, tempo2, result;
gettimeofday(&tempo1, NULL);
peo :: init( argc, argv );
@ -222,6 +224,7 @@ int main(int argc, char *argv[])
delete generationCounter;
delete increment;
cout << "\nCalculating Final Solutions...";
cout << " done\n";
@ -306,6 +309,23 @@ int main(int argc, char *argv[])
clades_pareto.close();
clades_final.close();
cout << "\nPhyloMOEA execution finishes !\n";
gettimeofday(&tempo2, NULL);
timeval_subtract(&result,&tempo2,&tempo1);
long remainder = result.tv_sec % 3600;
long hours = (result.tv_sec - remainder)/3600;
long seconds = remainder % 60;
long minutes = (remainder - seconds) / 60;
cout << "Execution time : ";
cout.width(3);
cout.fill(' ');
cout << hours << ":";
cout.width(2);
cout.fill('0');
cout << minutes << ":";
cout.width(2);
cout.fill('0');
cout << seconds << "." << result.tv_usec << endl;
}
gsl_rng_free(rn2);
// delete probmatrixs;