[Compbench-devel] CompBenchmarks++/System System.cpp, 1.14, 1.15 System.h, 1.14, 1.15
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-03 22:03:17
|
Update of /cvsroot/compbench/CompBenchmarks++/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23697 Modified Files: System.cpp System.h Log Message: Simplified interface to get benchmarks and packages. Index: System.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** System.cpp 28 Dec 2006 18:14:15 -0000 1.14 --- System.cpp 3 Jan 2007 22:03:09 -0000 1.15 *************** *** 116,124 **** ! std::vector<std::string> CBMSystem::bmList(void) { DIR *fd; struct dirent *de; - std::vector<std::string> result; std::string dum; unsigned int e; --- 116,123 ---- ! PackageVector &CBMSystem::packageList(int _force) { DIR *fd; struct dirent *de; std::string dum; unsigned int e; *************** *** 131,134 **** --- 130,136 ---- int inserted; + if ((packages.size()!=0) && (!_force)) + return(packages); + for(p_i=0;p_i<p_n;p_i++) { dir=cbmlib_paths[p_i]; *************** *** 152,158 **** inserted=0; ! r_n=result.size(); for(r_i=0;r_i<r_n;r_i++) { ! if (result[r_i] == dum) { inserted=1; break; --- 154,160 ---- inserted=0; ! r_n=packages.size(); for(r_i=0;r_i<r_n;r_i++) { ! if (packages[r_i] == dum) { inserted=1; break; *************** *** 161,165 **** if (!inserted) ! result.push_back(dum); } } --- 163,167 ---- if (!inserted) ! packages.push_back(dum); } } *************** *** 167,171 **** } ! return(result); } --- 169,208 ---- } ! return(packages); ! } ! ! int CBMSystem::packageNumber(void) ! { ! return(packages.size()); ! } ! ! char *CBMSystem::packageGet(int index) ! { ! return((char*) packages[index].c_str()); ! } ! ! CBMPackage *CBMSystem::Package(std::string pid) ! { ! cbmlib_internal *p = cbmlib_load((char*) pid.c_str()); ! ! if (p) ! return(p->PackageGet()); ! ! return(0); ! } ! ! CBMBenchmark *CBMSystem::Benchmark(std::string bid) ! { ! std::string pid; ! CBMPackage *P = 0; ! ! pid=Split(bid, "-", 0); ! P=Package(pid); ! ! if (P) { ! return(P->Benchmark(bid)); ! } ! ! return(0); } Index: System.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** System.h 28 Dec 2006 18:14:15 -0000 1.14 --- System.h 3 Jan 2007 22:03:09 -0000 1.15 *************** *** 15,18 **** --- 15,23 ---- #include <time.h> + + /** Defines a vector of packages. + */ + typedef std::vector<std::string> PackageVector; + /** \brief Operating system (and optionnaly hardware) abstraction layer. * *************** *** 39,42 **** --- 44,50 ---- protected: + /** \sa Packages() */ + PackageVector packages; + /** Stores the last (shell) command executed by compbenchmarks library. */ std::string lastCommand; *************** *** 117,121 **** * in declared directories. * \return a std::string list of benchmarks (id) */ ! virtual std::vector<std::string> bmList(void); /** Split a std::string. --- 125,135 ---- * in declared directories. * \return a std::string list of benchmarks (id) */ ! virtual PackageVector& packageList(int _force = 0); ! ! virtual int packageNumber(void); ! virtual char *packageGet(int index); ! ! virtual class CBMPackage *Package(std::string pid); ! virtual class CBMBenchmark *Benchmark(std::string bid); /** Split a std::string. |