[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Benchmark Benchmark.cpp, 1.1, 1.2 Benchmark.h,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-23 16:51:42
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23947 Modified Files: Benchmark.cpp Benchmark.h Log Message: Measures execution time. Index: Benchmark.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Benchmark.h 22 Jan 2007 18:21:47 -0000 1.1 --- Benchmark.h 23 Jan 2007 16:51:26 -0000 1.2 *************** *** 50,53 **** --- 50,56 ---- virtual std::string bench(void) = 0; + /** \sa executionTime() */ + std::string lastExecutionTime; + public: /** Display informations about benchmark *************** *** 68,73 **** --- 71,84 ---- * \return benchmark's result (performance) as a non-null positive number. May changes status. * \sa Make() + * \sa executionTime() * \sa status */ virtual std::string Bench(void); + + /** Give execution time. + * Returns last execution time (in seconds) of bench(). + * \return execution time in seconds + * \sa Bench() + * \sa bench() */ + virtual std::string executionTime(void); /** Virtual destructor */ Index: Benchmark.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Benchmark.cpp 22 Jan 2007 18:21:47 -0000 1.1 --- Benchmark.cpp 23 Jan 2007 16:51:26 -0000 1.2 *************** *** 41,45 **** std::string r; std::string info; ! if (((Package()->getStatus()<Package::Tested) && (Package()->hasTest())) && --- 41,47 ---- std::string r; std::string info; ! time_t beg; ! time_t end; ! char tmp[128]; if (((Package()->getStatus()<Package::Tested) && (Package()->hasTest())) && *************** *** 56,63 **** --- 58,70 ---- Name()); + + beg=System()->Time(); r=bench(); Package()->System()->Chomp(r); if (r!="0") { + end=System()->Time(); + sprintf(tmp, "%f", (double) (end-beg)); + lastExecutionTime=tmp; Package()->storeStatus(Package::Benchmarked); cbmUI->Information(CBM::UI::BenchResult, *************** *** 72,75 **** --- 79,87 ---- } + std::string Benchmark::executionTime(void) + { + return(lastExecutionTime); + } + Benchmark::~Benchmark() { |