From 0a469d15025c29219be51669b7344fc2115d93ce Mon Sep 17 00:00:00 2001 From: wcancino Date: Mon, 2 Mar 2009 15:29:28 +0000 Subject: [PATCH] Measures execution time git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1466 331e1502-861f-0410-8da2-ba01fb791d7f --- .../PhyloMOEA/PhyloMOEA/PhyloMOEA.cpp | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/contribution/branches/PhyloMOEA/PhyloMOEA/PhyloMOEA.cpp b/contribution/branches/PhyloMOEA/PhyloMOEA/PhyloMOEA.cpp index ce309f1b2..a429f6eb8 100644 --- a/contribution/branches/PhyloMOEA/PhyloMOEA/PhyloMOEA.cpp +++ b/contribution/branches/PhyloMOEA/PhyloMOEA/PhyloMOEA.cpp @@ -17,9 +17,9 @@ #include #include -#include #include + 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;