Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20118
Modified Files:
Package.cpp Package.h
Log Message:
Unique instance for each benchmark.
Index: Package.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Package.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Package.cpp 6 Feb 2007 19:41:24 -0000 1.9
--- Package.cpp 15 Feb 2007 18:56:29 -0000 1.10
***************
*** 48,57 ****
{
Benchmarks();
! return(Benchmark(benchmarks[i]));
}
CBM::Benchmark *Package::Benchmark(std::string bid)
{
! std::cerr << "virtual Package::Benchmark() called" << std::endl;
return(0);
}
--- 48,57 ----
{
Benchmarks();
! return(Benchmark(benchmarks[i]->id));
}
CBM::Benchmark *Package::Benchmark(std::string bid)
{
! std::cerr << "Package::Benchmark : virtual method called." << std::endl;
return(0);
}
***************
*** 99,102 ****
--- 99,115 ----
}
+ void Package::removeCached(CBM::Benchmark *_benchmark)
+ {
+ int i;
+ int n = benchmarkNumber();
+ CBM::BenchmarkCached *BC;
+
+ for(i=0; i<n; i++) {
+ BC=benchmarks[i];
+ if (BC->instance==_benchmark)
+ BC->instance=0;
+ }
+ }
+
int Package::hasPatch(void)
{
***************
*** 616,620 ****
Package::~Package()
{
! std::vector<Package*>::iterator it;
if (PACKAGE_AUTOPURGE) {
--- 629,642 ----
Package::~Package()
{
! std::vector<BenchmarkCached*>::iterator itb;
! std::vector<Package*>::iterator it;
!
!
! for(itb=benchmarks.begin(); itb!=benchmarks.end();) {
! if ((*itb)->instance)
! delete((*itb)->instance);
! delete(*itb);
! benchmarks.erase(itb);
! }
if (PACKAGE_AUTOPURGE) {
Index: Package.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Package.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Package.h 6 Feb 2007 17:54:02 -0000 1.5
--- Package.h 15 Feb 2007 18:56:29 -0000 1.6
***************
*** 33,40 ****
class System;
/** Defines a vector of benchmarks.
Basically owned by CBM::Package instance.
*/
! typedef std::vector<std::string> BenchmarkVector;
/** \brief Defines an abstract package.
--- 33,50 ----
class System;
+ /** Defines package's representation of a benchmark
+ * Cache every instance of a given benchmark so allowing that when
+ * Benchmark(std::string) or Benchmark(int) are called, the
+ * previously created instance, if exists is returned.
+ * \sa BenchmarkVector */
+ typedef struct {
+ std::string id;
+ CBM_BM *instance;
+ } BenchmarkCached;
+
/** Defines a vector of benchmarks.
Basically owned by CBM::Package instance.
*/
! typedef std::vector<BenchmarkCached*> BenchmarkVector;
/** \brief Defines an abstract package.
***************
*** 175,178 ****
--- 185,191 ----
CompilerOptions *_currentOptions);
public:
+
+ virtual void removeCached(CBM_BM *_benchmark);
+
/** Indicates if the package needs patching
* Must be overloaded if so. Returns 0 by default.
|