[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Plan Plan-Batch.cpp, 1.3, 1.4 Plan.cpp, 1.12,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-06-13 18:11:52
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22980 Modified Files: Plan-Batch.cpp Plan.cpp Log Message: Plan related messages added. Index: Plan.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Plan.cpp 6 Jun 2007 21:42:57 -0000 1.12 --- Plan.cpp 13 Jun 2007 18:11:37 -0000 1.13 *************** *** 19,22 **** --- 19,24 ---- #include <Base/Result.h> + #include <UI/UI.h> + using namespace CBM; *************** *** 71,76 **** --- 73,80 ---- CBM::PlanBatch *Plan::addBatch(CBM::PlanBatch *_batch) { + cbmUI->msgPlanBatchRegister(_batch->Id()); planBatch.push_back(_batch); stop(); + cbmUI->outputOK(); return(_batch); } *************** *** 84,87 **** --- 88,92 ---- int r = 0; + cbmUI->msgPlanBatchUnregister(_ps->Id()); for(i=0; i<n; i++) { B=getBatch(i); *************** *** 91,98 **** r=1; } ! delete(_ps); ! planBatch=nplanBatch; ! if (r) stop(); return(r); } --- 96,108 ---- r=1; } ! ! if (r) { stop(); + delete(_ps); + planBatch=nplanBatch; + cbmUI->outputOK(); + } else { + cbmUI->outputKO("Given batch not found"); + } return(r); } *************** *** 253,256 **** --- 263,267 ---- int Plan::store(std::string _filename) { + int r; XMLNode *root = XML(); std::string data = root->str(); *************** *** 260,264 **** filename=_filename; ! return(cbmSystem->fileWrite(filename, data)); } --- 271,284 ---- filename=_filename; ! // !!! default... ! cbmUI->msgPlanRegister(filename, ! 0); ! r=cbmSystem->fileWrite(filename, data); ! ! if (r) ! cbmUI->outputOK(); ! else ! cbmUI->outputKO(); ! return(r); } *************** *** 278,281 **** --- 298,303 ---- + cbmUI->msgPlanRestore(_filename); + filename=_filename; *************** *** 283,296 **** reset(); ! if (!planRootNode) return(0); if (planRootNode->Name()!="libcompbenchmarks-plan") { return(0); } PBs=planRootNode->getNode("plan-batchs"); ! if (!PBs) return(0); n=PBs->nodeNumber(); --- 305,323 ---- reset(); ! if (!planRootNode) { ! cbmUI->outputKO("Not a Plan XML file"); return(0); + } if (planRootNode->Name()!="libcompbenchmarks-plan") { + cbmUI->outputKO("Invalid plan file : root object is not libcompbenchmarks-plan"); return(0); } PBs=planRootNode->getNode("plan-batchs"); ! if (!PBs) { ! cbmUI->outputKO("Invalid plan file : <plan-batchs/> not found"); return(0); + } n=PBs->nodeNumber(); *************** *** 306,322 **** R=planRootNode->getNode("run"); ! if (!R) return(0); CI=R->getNode("iteration"); ! if (!CI) return(0); A=CI->getAttribute("index"); ! if (!A) return(0); iteration=atoi(A->Value().c_str()); return(1); } --- 333,357 ---- R=planRootNode->getNode("run"); ! if (!R) { ! cbmUI->outputKO("Invalid plan file : <run/> not fount"); return(0); + } CI=R->getNode("iteration"); ! if (!CI) { ! cbmUI->outputKO("Invalid plan file : <iteration/> not found"); return(0); + } A=CI->getAttribute("index"); ! if (!A) { ! cbmUI->outputKO("Invalid plan file : index attribute not found for <iteration/>"); return(0); + } iteration=atoi(A->Value().c_str()); + + cbmUI->outputOK(); return(1); } Index: Plan-Batch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan-Batch.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Plan-Batch.cpp 6 Jun 2007 21:42:57 -0000 1.3 --- Plan-Batch.cpp 13 Jun 2007 18:11:37 -0000 1.4 *************** *** 17,20 **** --- 17,22 ---- #include <Base/Result.h> + #include <UI/UI.h> + using namespace CBM; *************** *** 146,150 **** int PlanBatch::add(CBM::Compiler *_compiler) { ! if ((!_compiler) || (!isUnique(_compiler))) { return(0); } --- 148,161 ---- int PlanBatch::add(CBM::Compiler *_compiler) { ! cbmUI->msgPlanCompilerRegister(_compiler->Name()); ! ! if (!_compiler) { ! cbmUI->outputKO("Not a supported compiler"); ! return(0); ! } ! ! if (!isUnique(_compiler)) { ! cbmUI->outputInfo("Compiler already exists in batch"); ! cbmUI->outputKO(); return(0); } *************** *** 152,155 **** --- 163,168 ---- compilers.push_back(_compiler); stop(); + + cbmUI->outputOK(); return(1); } *************** *** 157,161 **** int PlanBatch::add(CBM::CompilerOptionSet *_set) { ! if ((!_set) || (!isUnique(_set))) { return(0); } --- 170,184 ---- int PlanBatch::add(CBM::CompilerOptionSet *_set) { ! cbmUI->msgPlanOptionsetRegister(_set->Id()); ! ! if (!_set) { ! cbmUI->outputInfo("No valid option set given"); ! cbmUI->outputKO(); ! return(0); ! } ! ! if (!isUnique(_set)) { ! cbmUI->outputInfo("Option set already exists in batch"); ! cbmUI->outputKO(); return(0); } *************** *** 163,166 **** --- 186,191 ---- compilerOptions.push_back(_set); stop(); + + cbmUI->outputOK(); return(1); } *************** *** 174,181 **** int PlanBatch::add(CBM::Benchmark *_benchmark) { ! if ((!_benchmark) || (!isUnique(_benchmark))) { return(0); } if (_benchmark->Package()->getStatus()<CBM::Package::Preconfigured) { return(0); } --- 199,218 ---- int PlanBatch::add(CBM::Benchmark *_benchmark) { ! cbmUI->msgPlanBenchmarkRegister(_benchmark->Name()); ! ! if (!_benchmark) { ! cbmUI->outputInfo("No valid/supported benchmark given"); ! cbmUI->outputKO(); ! return(0); ! } ! ! if (!isUnique(_benchmark)) { ! cbmUI->outputInfo("Benchmark already exists in batch"); ! cbmUI->outputKO(); return(0); } if (_benchmark->Package()->getStatus()<CBM::Package::Preconfigured) { + cbmUI->outputInfo("Benchmark not configured. Please finish its installation"); + cbmUI->outputKO(); return(0); } *************** *** 183,186 **** --- 220,224 ---- benchmarks.push_back(_benchmark); stop(); + cbmUI->outputOK(); return(1); } *************** *** 194,197 **** --- 232,236 ---- int found = 0; + cbmUI->msgPlanCompilerUnregister(_compiler->Name()); for(i=0; i<n; i++) { C=getCompiler(i); *************** *** 205,212 **** } } - compilers=ncompilers; ! if (found) stop(); return(found); } --- 244,256 ---- } } ! if (found) { ! compilers=ncompilers; stop(); + cbmUI->outputOK(); + } else { + cbmUI->outputInfo("No such compiler in batch"); + cbmUI->outputKO(); + } return(found); } *************** *** 220,223 **** --- 264,268 ---- int found = 0; + cbmUI->msgPlanOptionsetUnregister(_set->Id()); for(i=0; i<n; i++) { OS=getCompilerOptions(i); *************** *** 230,236 **** } } ! compilerOptions=noptions; ! if (found) stop(); return(found); } --- 275,287 ---- } } ! ! if (found) { ! compilerOptions=noptions; stop(); + cbmUI->outputOK(); + } else { + cbmUI->outputInfo("No such option set in batch"); + cbmUI->outputKO(); + } return(found); } *************** *** 249,261 **** CBM::Benchmark *B = 0; std::vector<CBM::Benchmark*> nbenchmarks; for(i=0; i<n; i++) { B=getBenchmark(i); if (B!=_benchmark) nbenchmarks.push_back(B); } ! stop(); ! benchmarks=nbenchmarks; ! return(1); } --- 300,325 ---- CBM::Benchmark *B = 0; std::vector<CBM::Benchmark*> nbenchmarks; + int found = 0; + cbmUI->msgPlanBenchmarkUnregister(_benchmark->Name()); + for(i=0; i<n; i++) { B=getBenchmark(i); if (B!=_benchmark) nbenchmarks.push_back(B); + else + found=1; } ! ! if (found) { ! stop(); ! benchmarks=nbenchmarks; ! cbmUI->outputOK(); ! } else { ! cbmUI->outputInfo("No such benchmark in batch"); ! cbmUI->outputKO(); ! } ! ! return(found); } *************** *** 451,454 **** --- 515,520 ---- void PlanBatch::stop(void) { + if (iteration) + cbmUI->outputInfo("Context changed : current plan benchmarking will be restarted."); iteration=0; } |