[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Plan Plan-Batch.cpp, 1.1, 1.2 Plan-Batch.h, 1.
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-30 17:02:30
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14605 Modified Files: Plan-Batch.cpp Plan-Batch.h Log Message: Identifier introduced in CBM::CompilerOptions. Few changes on XML I/O. Index: Plan-Batch.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan-Batch.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Plan-Batch.h 17 May 2007 14:32:16 -0000 1.1 --- Plan-Batch.h 30 May 2007 17:02:27 -0000 1.2 *************** *** 67,71 **** virtual int add(class Compiler *_compiler); virtual int add(CBM_OS *_set); ! virtual CBM_OP *addOptions(CBM_OS *_set); virtual int add(class Benchmark *_benchmark); --- 67,71 ---- virtual int add(class Compiler *_compiler); virtual int add(CBM_OS *_set); ! virtual CBM_OP *addOptions(CBM_OS *_set, std::string _id); virtual int add(class Benchmark *_benchmark); *************** *** 85,88 **** --- 85,90 ---- virtual class Compiler* getCompiler(int _index); virtual CBM_OS *getCompilerOptions(int _index); + virtual CBM_OS *getCompilerOptions(std::string id); + virtual CBM_BM *getBenchmark(int _index); Index: Plan-Batch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan-Batch.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Plan-Batch.cpp 17 May 2007 14:32:16 -0000 1.1 --- Plan-Batch.cpp 30 May 2007 17:02:27 -0000 1.2 *************** *** 115,118 **** --- 115,119 ---- continue; COS=new CBM::CompilerOptionSet(A->Value()); + COS->restore(N); add(COS); } *************** *** 165,171 **** } ! CBM::CompilerOptions *PlanBatch::addOptions(CBM::CompilerOptionSet *_set) { ! return(_set->add()); } --- 166,173 ---- } ! CBM::CompilerOptions *PlanBatch::addOptions(CBM::CompilerOptionSet *_set, ! std::string _id) { ! return(_set->add(_id)); } *************** *** 187,199 **** CBM::Compiler *C = 0; std::vector<CBM::Compiler*> ncompilers; for(i=0; i<n; i++) { C=getCompiler(i); ! if (C!=_compiler) ncompilers.push_back(C); } compilers=ncompilers; ! stop(); ! return(1); } --- 189,210 ---- CBM::Compiler *C = 0; std::vector<CBM::Compiler*> ncompilers; + int found = 0; for(i=0; i<n; i++) { C=getCompiler(i); ! if ((C->Binary()!=_compiler->Binary()) && ! (C->Name()!=_compiler->Name())) ncompilers.push_back(C); + else { + if (C!=_compiler) + delete(C); + found=1; + } } compilers=ncompilers; ! ! if (found) ! stop(); ! return(found); } *************** *** 204,216 **** CBM::CompilerOptionSet *OS = 0; std::vector<CBM::CompilerOptionSet*> noptions; for(i=0; i<n; i++) { OS=getCompilerOptions(i); ! if (OS!=_set) noptions.push_back(OS); } compilerOptions=noptions; ! stop(); ! return(1); } --- 215,234 ---- CBM::CompilerOptionSet *OS = 0; std::vector<CBM::CompilerOptionSet*> noptions; + int found = 0; for(i=0; i<n; i++) { OS=getCompilerOptions(i); ! if (OS->Id()!=_set->Id()) noptions.push_back(OS); + else { + if (OS!=_set) + delete(OS); + found=1; + } } compilerOptions=noptions; ! if (found) ! stop(); ! return(found); } *************** *** 271,274 **** --- 289,305 ---- } + CBM::CompilerOptionSet *PlanBatch::getCompilerOptions(std::string id) + { + CBM::CompilerOptionSet *c = 0; + int i, n = compilerOptionNumber(); + + for(i=0;i<n;i++) { + c=getCompilerOptions(i); + if (c->Id()==id) + return(c); + } + return(0); + } + CBM::Benchmark *PlanBatch::getBenchmark(int _index) { *************** *** 376,380 **** XMLNode *SB = new CBM::XMLNode("benchmarks"); XMLNode *SC = new CBM::XMLNode("compilers"); ! XMLNode *OS = new CBM::XMLNode("option-set"); XMLNode *tmp; --- 407,411 ---- XMLNode *SB = new CBM::XMLNode("benchmarks"); XMLNode *SC = new CBM::XMLNode("compilers"); ! XMLNode *OS = new CBM::XMLNode("option-sets"); XMLNode *tmp; *************** *** 408,413 **** n=compilerOptionNumber(); for(i=0; i<n; i++) { ! tmp=new CBM::XMLNode("set"); ! tmp->addAttribute("value", getCompilerOptions(i)->Id()); OS->add(tmp); } --- 439,443 ---- n=compilerOptionNumber(); for(i=0; i<n; i++) { ! tmp=getCompilerOptions(i)->XML(); OS->add(tmp); } *************** *** 442,449 **** int PlanBatch::store(void) { ! XMLNode *root = XML(); ! cbmSystem->Config()->setPlan(root); ! return(cbmSystem->storeConfiguration()); } --- 472,481 ---- int PlanBatch::store(void) { ! /* ! XMLNode *root = XML(); ! cbmSystem->Config()->setPlan(root); ! return(cbmSystem->storeConfiguration()); ! */ } *************** *** 451,458 **** { XMLNode *S; - XMLNode *R; XMLNode *BM; XMLNode *OS; XMLNode *OP; XMLNode *CI; XMLAttribute *A; --- 483,490 ---- { XMLNode *S; XMLNode *BM; XMLNode *OS; XMLNode *OP; + XMLNode *CO; XMLNode *CI; XMLAttribute *A; *************** *** 470,477 **** return(0); - R=_planRootNode->getNode("run"); - if (!R) - return(0); - BM=S->getNode("benchmarks"); if (!BM) --- 502,505 ---- *************** *** 486,511 **** restoreCompilerOptionSet(OS); ! /* CO=S->getNode("compilers"); ! if (!CO) ! return(0); ! ! restoreCompilers(CO); ! !!! ! */ ! OP=S->getNode("options"); ! if (!OP) return(0); ! CI=R->getNode("current-iteration"); ! if (!CI) ! return(0); ! A=CI->getAttribute("index"); ! ! if (!A) return(0); - iteration=atoi(A->Value().c_str()); return(1); } --- 514,528 ---- restoreCompilerOptionSet(OS); ! CO=S->getNode("compilers"); ! if (!CO) return(0); ! restoreCompilers(CO); ! OP=S->getNode("options"); ! if (!OP) return(0); return(1); } |