compbench-devel Mailing List for CompBenchmarks (Page 9)
Brought to you by:
xfred
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(48) |
Oct
(51) |
Nov
(66) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(242) |
Feb
(56) |
Mar
(95) |
Apr
(120) |
May
(127) |
Jun
(32) |
Jul
(10) |
Aug
(55) |
Sep
(114) |
Oct
(3) |
Nov
|
Dec
|
From: Frederic T. <xf...@us...> - 2007-06-06 18:04:56
|
Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/reference In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24919 Modified Files: compbenchmarks-config-0.xml Log Message: Match changes on CBM::Config (<defaults/> node, removed plan). Index: compbenchmarks-config-0.xml =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/reference/compbenchmarks-config-0.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** compbenchmarks-config-0.xml 25 Jan 2007 17:06:00 -0000 1.3 --- compbenchmarks-config-0.xml 6 Jun 2007 18:04:52 -0000 1.4 *************** *** 5,9 **** <benchmark id="gzip-1c" status="0"/> </benchmarks> ! <paths/> ! <plan/> </libcompbenchmarks> \ No newline at end of file --- 5,10 ---- <benchmark id="gzip-1c" status="0"/> </benchmarks> ! <defaults> ! <paths/> ! </defaults> </libcompbenchmarks> \ No newline at end of file |
From: Frederic T. <xf...@us...> - 2007-06-06 17:52:52
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15592 Modified Files: UI.cpp UI.h UI-Msg.cpp UI-Msg.h Log Message: New messages handled. Index: UI.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UI.h 6 Jun 2007 15:55:07 -0000 1.7 --- UI.h 6 Jun 2007 17:39:19 -0000 1.8 *************** *** 51,54 **** --- 51,55 ---- virtual UIMsg *msgUninstall(std::string _name); virtual UIMsg *msgBench(std::string _name); + virtual UIMsg *msgGroup(std::string _name); virtual UIMsg *outputInfo(std::string _text); Index: UI.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UI.cpp 6 Jun 2007 15:55:07 -0000 1.8 --- UI.cpp 6 Jun 2007 17:39:19 -0000 1.9 *************** *** 198,201 **** --- 198,209 ---- } + UIMsg *UI::msgGroup(std::string _name) + { + UIMsg *msg = new UIMsgGroup(_name); + postMsg(msg); + + return(msg); + } + UIMsg *UI::outputInfo(std::string _test) { Index: UI-Msg.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Msg.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UI-Msg.h 6 Jun 2007 15:54:38 -0000 1.1 --- UI-Msg.h 6 Jun 2007 17:39:19 -0000 1.2 *************** *** 46,49 **** --- 46,50 ---- UndefAction, ShellCommand, + Group, Create, Read, Write, Remove, Checksum, PackageInstall, PackageUninstall, *************** *** 197,200 **** --- 198,208 ---- virtual ~UIMsgBench(); }; + + class UIMsgGroup : public UIMsg { + public: + UIMsgGroup(std::string _name); + + virtual ~UIMsgGroup(); + }; } Index: UI-Msg.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UI-Msg.cpp 6 Jun 2007 15:54:38 -0000 1.1 --- UI-Msg.cpp 6 Jun 2007 17:39:19 -0000 1.2 *************** *** 291,292 **** --- 291,303 ---- } + UIMsgGroup::UIMsgGroup(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(Group); + } + + UIMsgGroup::~UIMsgGroup() + { + } + |
From: Frederic T. <xf...@us...> - 2007-06-06 17:52:51
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15621 Modified Files: UI-Console.cpp Log Message: New messages handled. Changes in way displaying infos & outputs. Index: UI-Console.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Console.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UI-Console.cpp 6 Jun 2007 15:54:38 -0000 1.1 --- UI-Console.cpp 6 Jun 2007 17:39:59 -0000 1.2 *************** *** 165,168 **** --- 165,180 ---- curmsg+=objectField(_msg, "name"); break; + case UIMsg::PackageConfigure: + curmsg+="Configuring "; + curmsg+=objectField(_msg, "name"); + break; + case UIMsg::PackageMake: + curmsg+="Building "; + curmsg+=objectField(_msg, "name"); + break; + case UIMsg::PackageClean: + curmsg+="Cleaning "; + curmsg+=objectField(_msg, "name"); + break; case UIMsg::PackagePreconfigure: curmsg+="Pre-configure "; *************** *** 185,188 **** --- 197,203 ---- curmsg+=objectField(_msg, "name"); break; + case UIMsg::Group: + curmsg+=objectField(_msg, "name"); + break; default: curmsg+="Display::DEFAULT/"; *************** *** 219,222 **** --- 234,239 ---- int d = depth(_msg); int s; + int p_sp = 0; + int frc = 0; // std::cout << _msg->str() << std::endl; *************** *** 237,244 **** status=(UIMsg::Status)atoi(A->Value().c_str()); ! if (childNumber(_msg)) { s=d+1; while (s--) std::cout << " "; } --- 254,262 ---- status=(UIMsg::Status)atoi(A->Value().c_str()); ! if ((frc) || (childNumber(_msg))) { s=d+1; while (s--) std::cout << " "; + p_sp=1; } *************** *** 255,269 **** --- 273,300 ---- std::cout << "OK"; lastisLF=0; + p_sp=0; break; case UIMsg::KO: std::cout << "Failed."; lastisLF=0; + p_sp=0; break; case UIMsg::Info: + if (!lastisLF) { + LF(); + if (d) { + s=d+1; + while (s--) + std::cout << " "; + p_sp=1; + } + } std::cout << N->Value(); + p_sp=0; lastisLF=0; break; } LF(); + frc=1; } // lastisLF=0; |
From: Frederic T. <xf...@us...> - 2007-06-06 16:03:08
|
Update of /cvsroot/compbench/CompBenchmarks++/SupportedBenchmarks In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12164 Modified Files: Benchmark-SCIMARK2.cpp Log Message: extract() fixed. Index: Benchmark-SCIMARK2.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/SupportedBenchmarks/Benchmark-SCIMARK2.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Benchmark-SCIMARK2.cpp 25 Jan 2007 17:19:56 -0000 1.8 --- Benchmark-SCIMARK2.cpp 6 Jun 2007 16:03:02 -0000 1.9 *************** *** 114,118 **** cmd+=" && "; cmd+=CBM_PROG_UNZIP; ! cmd+=" -f "; cmd+=system->Directory(CBM::System::Download); cmd+="/"; --- 114,118 ---- cmd+=" && "; cmd+=CBM_PROG_UNZIP; ! cmd+=" -o "; cmd+=system->Directory(CBM::System::Download); cmd+="/"; |
From: Frederic T. <xf...@us...> - 2007-06-06 16:02:15
|
Update of /cvsroot/compbench/CompBenchmarks++/compbenchmarks-core In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12089 Modified Files: cloptions.cpp Log Message: XML based message reporting. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/compbenchmarks-core/cloptions.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cloptions.cpp 30 May 2007 17:09:48 -0000 1.2 --- cloptions.cpp 6 Jun 2007 16:02:11 -0000 1.3 *************** *** 94,98 **** str="Unexpected option : "; str+=opt; ! CBM::cbmUI->Fatal(str); } else { *domain=value; --- 94,98 ---- str="Unexpected option : "; str+=opt; ! CBM::cbmUI->msgFatal(str); } else { *domain=value; *************** *** 429,433 **** if (P) { if (!UO_enableTestSuite) { ! CBM::cbmUI->Fatal("Incompatible options : --test and --disable-testsuite"); } } --- 429,433 ---- if (P) { if (!UO_enableTestSuite) { ! CBM::cbmUI->msgFatal("Incompatible options : --test and --disable-testsuite"); } } |
From: Frederic T. <xf...@us...> - 2007-06-06 16:01:47
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11737 Modified Files: Config.cpp Log Message: XML based message reporting. Index: Config.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Config.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Config.cpp 28 May 2007 18:08:00 -0000 1.11 --- Config.cpp 6 Jun 2007 16:01:43 -0000 1.12 *************** *** 216,220 **** break; default: ! cbmUI->Fatal("Internal : Bad 'where' parameters in System::temporaryDirectory();"); return(""); } --- 216,220 ---- break; default: ! cbmUI->msgFatal("Internal : Bad 'where' parameters in System::temporaryDirectory();"); return(""); } |
From: Frederic T. <xf...@us...> - 2007-06-06 16:01:15
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11582 Modified Files: Thread.cpp Thread.h Log Message: currentThread() added. Index: Thread.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Thread.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Thread.h 16 May 2007 09:44:19 -0000 1.1 --- Thread.h 6 Jun 2007 16:01:09 -0000 1.2 *************** *** 79,82 **** --- 79,84 ---- ~ThreadActionTest(); }; + + pthread_t currentThread(void); } Index: Thread.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Thread.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Thread.cpp 16 May 2007 09:44:19 -0000 1.1 --- Thread.cpp 6 Jun 2007 16:01:08 -0000 1.2 *************** *** 146,147 **** --- 146,152 ---- { } + + pthread_t CBM::currentThread(void) + { + return(pthread_self()); + } |
From: Frederic T. <xf...@us...> - 2007-06-06 16:00:37
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11258 Modified Files: XML.cpp XML.h Log Message: getParent() added. Index: XML.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/XML.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XML.h 1 May 2007 15:05:00 -0000 1.7 --- XML.h 6 Jun 2007 16:00:29 -0000 1.8 *************** *** 133,136 **** --- 133,138 ---- virtual XMLNode *getNode(std::string _name); + virtual XMLNode *getParent(void); + /** Get attributes' number. * Index: XML.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/XML.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XML.cpp 12 Apr 2007 19:58:58 -0000 1.7 --- XML.cpp 6 Jun 2007 16:00:29 -0000 1.8 *************** *** 146,149 **** --- 146,154 ---- } + XMLNode *XMLNode::getParent(void) + { + return(parent); + } + int XMLNode::attributeNumber(void) { |
From: Frederic T. <xf...@us...> - 2007-06-06 15:59:51
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10801 Modified Files: Benchmark.cpp Benchmark-xZIP.cpp Package.cpp Log Message: XML based message reporting. Index: Package.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Package.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Package.cpp 16 May 2007 12:06:17 -0000 1.13 --- Package.cpp 6 Jun 2007 15:59:47 -0000 1.14 *************** *** 213,218 **** if (cbmSystem->fileExists(localFile)) { ! cbmUI->Information(CBM::UI::Checksum, ! localFile); expected_md5=expectedMD5(); --- 213,217 ---- if (cbmSystem->fileExists(localFile)) { ! cbmUI->msgChecksum(localFile); expected_md5=expectedMD5(); *************** *** 220,249 **** if (expected_md5==md5) { ! cbmUI->Information(CBM::UI::Checksum, ! CBM::UI::OK); ! storeStatus(Downloaded); return(1); } else { ! cbmUI->Information(CBM::UI::Checksum, ! CBM::UI::Failed); system->unlink((char*) localFile.c_str()); ! info="Unsuccesfull download "; info+=downloadURL(); info+=" to "; info+=localFile; ! cbmUI->Fatal(info); return(0); } } else { - cbmUI->Information(CBM::UI::Checksum, - CBM::UI::Failed); - info="Can't download "; info+=downloadURL(); info+=" to "; info+=localFile; ! cbmUI->Fatal(info); ! system->unlink((char*) localFile.c_str()); } --- 219,241 ---- if (expected_md5==md5) { ! cbmUI->outputOK(); storeStatus(Downloaded); return(1); } else { ! cbmUI->outputKO(); system->unlink((char*) localFile.c_str()); ! info="Invalid checksum. Unsuccesfull download "; info+=downloadURL(); info+=" to "; info+=localFile; ! cbmUI->msgFatal(info); return(0); } } else { info="Can't download "; info+=downloadURL(); info+=" to "; info+=localFile; ! cbmUI->outputKO(info); system->unlink((char*) localFile.c_str()); } *************** *** 260,265 **** } ! cbmUI->Information(CBM::UI::PackageExtract, ! Name()); r=extract(_force); --- 252,256 ---- } ! cbmUI->msgExtract(Name()); r=extract(_force); *************** *** 267,276 **** if (r) { storeStatus(Extracted); ! cbmUI->Information(CBM::UI::PackageExtract, ! CBM::UI::OK); } else { ! cbmUI->Information(CBM::UI::PackageExtract, ! CBM::UI::Failed); std::string info; info="Error extracting "; --- 258,265 ---- if (r) { storeStatus(Extracted); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); std::string info; info="Error extracting "; *************** *** 278,282 **** info+=" into "; info+=system->Directory(System::Extract); ! cbmUI->Fatal(info); } --- 267,271 ---- info+=" into "; info+=system->Directory(System::Extract); ! cbmUI->msgFatal(info); } *************** *** 296,316 **** } ! cbmUI->Information(CBM::UI::PackagePatch, ! Name()); ! r=patch(_force); if (r) { storeStatus(Patched); ! cbmUI->Information(CBM::UI::PackagePatch, ! CBM::UI::OK); ! } else { ! cbmUI->Information(CBM::UI::PackagePatch, ! CBM::UI::Failed); std::string info; info="Error patching "; info+=localAbsoluteName(); ! cbmUI->Fatal(info); } --- 285,300 ---- } ! cbmUI->msgPatch(Name()); r=patch(_force); if (r) { storeStatus(Patched); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); std::string info; info="Error patching "; info+=localAbsoluteName(); ! cbmUI->msgFatal(info); } *************** *** 331,346 **** ! cbmUI->Information(CBM::UI::PackagePreconfigure, ! Name()); ! r=preConfigure(_force); if (r) { storeStatus(Preconfigured); ! cbmUI->Information(CBM::UI::PackagePreconfigure, ! CBM::UI::OK); } else { ! cbmUI->Information(CBM::UI::PackagePreconfigure, ! CBM::UI::Failed); std::string info; --- 315,326 ---- ! cbmUI->msgPreconfigure(Name()); r=preConfigure(_force); if (r) { storeStatus(Preconfigured); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); std::string info; *************** *** 348,352 **** info+=Name(); info+="'s pre-configuration"; ! cbmUI->Fatal(info); } return(r); --- 328,332 ---- info+=Name(); info+="'s pre-configuration"; ! cbmUI->msgFatal(info); } return(r); *************** *** 385,400 **** info+=language(); info+="."; ! cbmUI->Fatal(info); } ! cbmUI->Information(CBM::UI::PackageConfigure, ! info); ! r=configure(_currentCompiler, _currentOptions); if (r) { ! cbmUI->Information(CBM::UI::PackageConfigure, ! CBM::UI::OK); storeStatus(Configured); --- 365,378 ---- info+=language(); info+="."; ! cbmUI->msgFatal(info); ! return(0); } ! cbmUI->msgConfigure(info); r=configure(_currentCompiler, _currentOptions); if (r) { ! cbmUI->outputOK(); storeStatus(Configured); *************** *** 402,410 **** currentOptions=_currentOptions; } else { ! cbmUI->Information(CBM::UI::PackageConfigure, ! CBM::UI::Failed); info="Configure failed for "; info+=Name(); ! cbmUI->Fatal(info); } --- 380,387 ---- currentOptions=_currentOptions; } else { ! cbmUI->outputKO(); info="Configure failed for "; info+=Name(); ! cbmUI->msgFatal(info); } *************** *** 424,429 **** } ! cbmUI->Information(CBM::UI::PackageMake, ! Name()); system->startTimer(); --- 401,405 ---- } ! cbmUI->msgMake(Name()); system->startTimer(); *************** *** 433,449 **** sprintf(tmp, "%f", end); lastBuildTime=tmp; ! std::cout << "Build time : " << lastBuildTime << std::endl; storeStatus(Made); storeContext(currentCompiler, currentOptions); System()->storeConfiguration(); ! cbmUI->Information(CBM::UI::PackageMake, ! CBM::UI::OK); } else { ! cbmUI->Information(CBM::UI::PackageMake, ! CBM::UI::Failed); info="Make failed for "; info+=Name(); ! cbmUI->Fatal(info); } --- 409,425 ---- sprintf(tmp, "%f", end); lastBuildTime=tmp; ! std::string i = "Build time : "; ! i+=lastBuildTime; ! cbmUI->outputInfo(i); storeStatus(Made); storeContext(currentCompiler, currentOptions); System()->storeConfiguration(); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); info="Make failed for "; info+=Name(); ! cbmUI->msgFatal(info); } *************** *** 466,470 **** if (getStatus()<Configured) { ! cbmUI->Fatal("Package is not configured"); } --- 442,446 ---- if (getStatus()<Configured) { ! cbmUI->msgFatal("Package is not configured"); } *************** *** 479,492 **** if (UO_enableTestSuite) { ! cbmUI->Information(CBM::UI::PackageTest, ! Name()); ! ! r=test(_force); } else { dum=Name(); dum+=" : passed (disabled by user option)."; ! cbmUI->Information(CBM::UI::PackageTest, ! dum); r=1; } --- 455,464 ---- if (UO_enableTestSuite) { ! cbmUI->msgTest(Name()); r=test(_force); } else { dum=Name(); dum+=" : passed (disabled by user option)."; ! cbmUI->outputInfo(dum); r=1; } *************** *** 494,506 **** if (r) { storeStatus(Tested); ! cbmUI->Information(CBM::UI::PackageTest, ! CBM::UI::OK); } else { ! cbmUI->Information(CBM::UI::PackageTest, ! CBM::UI::Failed); std::string info; info="Error testing "; info+=localAbsoluteName(); ! cbmUI->Fatal(info); } --- 466,476 ---- if (r) { storeStatus(Tested); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); std::string info; info="Error testing "; info+=localAbsoluteName(); ! cbmUI->msgFatal(info); } *************** *** 517,522 **** } ! cbmUI->Information(CBM::UI::PackageClean, ! Name()); --- 487,491 ---- } ! cbmUI->msgRelease(Name()); *************** *** 525,536 **** resetContext(); storeStatus(Preconfigured); ! cbmUI->Information(CBM::UI::PackageClean, ! CBM::UI::OK); } else { ! cbmUI->Information(CBM::UI::PackageClean, ! CBM::UI::Failed); info="Clean failed for "; info+=Name(); ! /* cbmUI->Fatal(info); */ } --- 494,503 ---- resetContext(); storeStatus(Preconfigured); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); info="Clean failed for "; info+=Name(); ! cbmUI->msgFatal(info); } *************** *** 542,547 **** int r; if (downloadURL()=="") { ! cbmUI->Fatal("Package is not known to be hosted anymore on the Internet. Use --fetch option."); } --- 509,516 ---- int r; + cbmUI->msgInstall(Name()); if (downloadURL()=="") { ! cbmUI->msgFatal("Package is not known to be hosted anymore on the Internet. Use --fetch option."); ! return(0); } *************** *** 549,554 **** r=Download(_force); ! if (!r) return(0); r=Extract(_force); --- 518,525 ---- r=Download(_force); ! if (!r) { ! cbmUI->outputKO(); return(0); + } r=Extract(_force); *************** *** 558,566 **** if (hasPatch()) { r=Patch(); ! if (!r) return(0); } r=PreConfigure(_force); return(r); } --- 529,544 ---- if (hasPatch()) { r=Patch(); ! if (!r) { ! cbmUI->outputKO(); return(0); + } } r=PreConfigure(_force); + + if (r) + cbmUI->outputOK(); + else + cbmUI->outputKO(); return(r); } *************** *** 577,580 **** --- 555,560 ---- } + cbmUI->msgFetch(Name()); + if (dest!=source) { cbmSystem->copy(source, dest); *************** *** 584,602 **** expected_md5=expectedMD5(); - cbmUI->Information(CBM::UI::Checksum, - dest); md5=system->md5File(dest); if (expected_md5==md5) { ! cbmUI->Information(CBM::UI::Checksum, ! CBM::UI::OK); ! storeStatus(Downloaded); return(1); } else { ! cbmUI->Information(CBM::UI::Checksum, ! CBM::UI::Failed); } } --- 564,580 ---- expected_md5=expectedMD5(); md5=system->md5File(dest); if (expected_md5==md5) { ! cbmUI->outputOK("Checksum verified"); storeStatus(Downloaded); return(1); } else { ! cbmUI->outputKO("Bad checksum"); } + } else { + cbmUI->outputKO(); + cbmUI->msgFatal("Invalid destination file"); } *************** *** 608,613 **** int r; ! cbmUI->Information(CBM::UI::PackageUninstall, ! Name()); if (getStatus()!=Unknown) { --- 586,590 ---- int r; ! cbmUI->msgUninstall(Name()); if (getStatus()!=Unknown) { *************** *** 620,632 **** if (r) ! cbmUI->Information(CBM::UI::PackageUninstall, ! CBM::UI::OK); else ! cbmUI->Information(CBM::UI::PackageUninstall, ! CBM::UI::Failed); return(r); } else { ! cbmUI->Information(CBM::UI::PackageUninstall, ! CBM::UI::Failed); return(0); } --- 597,606 ---- if (r) ! cbmUI->outputOK(); else ! cbmUI->outputKO(); return(r); } else { ! cbmUI->outputKO(); return(0); } Index: Benchmark-xZIP.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark-xZIP.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Benchmark-xZIP.cpp 16 May 2007 12:07:09 -0000 1.4 --- Benchmark-xZIP.cpp 6 Jun 2007 15:59:47 -0000 1.5 *************** *** 63,69 **** while(!T.Terminated()) { sleep(1); ! cbmUI->Information(CBM::UI::PackagePreconfigure, ! CBM::UI::Running, ! T.Progress()); } --- 63,67 ---- while(!T.Terminated()) { sleep(1); ! cbmUI->Progress(T.Progress()); } Index: Benchmark.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Benchmark.cpp 23 May 2007 18:23:16 -0000 1.10 --- Benchmark.cpp 6 Jun 2007 15:59:47 -0000 1.11 *************** *** 59,77 **** char tmp[128]; if (((Package()->getStatus()<Package::Tested) && (Package()->hasTest())) && (UO_enableTestSuite)) { info=Name(); info+=" not tested !"; ! cbmUI->Information(CBM::UI::PackageTest, ! info, ! CBM::UI::Failed); ! return("0"); } - cbmUI->Information(CBM::UI::BenchBench, - Name()); - - System()->startTimer(); r=bench(); --- 59,71 ---- char tmp[128]; + cbmUI->msgBench(Name()); if (((Package()->getStatus()<Package::Tested) && (Package()->hasTest())) && (UO_enableTestSuite)) { info=Name(); info+=" not tested !"; ! cbmUI->outputKO(info); return("0"); } System()->startTimer(); r=bench(); *************** *** 83,98 **** lastExecutionTime=tmp; Package()->storeStatus(Package::Benchmarked); ! cbmUI->Information(CBM::UI::BenchResult, ! CBM::UI::OK); ! cbmUI->InformationBenchmarkResult(Name(), ! tmp, ! r); } else { ! cbmUI->Information(CBM::UI::BenchResult, ! CBM::UI::Failed); info="Benchmarking failed for "; info+=Package()->Name(); ! cbmUI->Fatal(info); } --- 77,93 ---- lastExecutionTime=tmp; Package()->storeStatus(Package::Benchmarked); ! std::string i_tme = "Execution time : "; ! i_tme+=tmp; ! std::string i_r = "Result : "; ! i_r+=r; ! cbmUI->outputInfo(i_tme); ! cbmUI->outputInfo(i_r); ! cbmUI->outputOK(); } else { ! cbmUI->outputKO(); info="Benchmarking failed for "; info+=Package()->Name(); ! cbmUI->msgFatal(info); } |
From: Frederic T. <xf...@us...> - 2007-06-06 15:59:35
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10783 Modified Files: System-Unix.cpp Log Message: XML based message reporting. Index: System-Unix.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System-Unix.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** System-Unix.cpp 19 Apr 2007 20:54:14 -0000 1.4 --- System-Unix.cpp 6 Jun 2007 15:59:31 -0000 1.5 *************** *** 60,65 **** result=""; lastCommand=command; if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) ) { ! cbmUI->Fatal("Can't create pipe."); } --- 60,66 ---- result=""; lastCommand=command; + cbmUI->msgShell(command); if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) ) { ! cbmUI->msgFatal("Can't create pipe."); } *************** *** 67,70 **** --- 68,72 ---- result+=line; } + cbmUI->outputOK(result); lastCommandOutput=result; return(pclose(fpipe)); |
From: Frederic T. <xf...@us...> - 2007-06-06 15:59:19
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10765 Modified Files: System.cpp Log Message: XML based message reporting. New path for benchmark (because of move of compbenchmarks-core in a sub-directory). downloadNow() uses system() call to prevent messages to be send by another thread. Index: System.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** System.cpp 28 May 2007 18:06:26 -0000 1.16 --- System.cpp 6 Jun 2007 15:59:16 -0000 1.17 *************** *** 14,18 **** #include <Benchmark/Benchmark-DLLoader.h> ! #include <UI/UI.h> #include <iostream> --- 14,18 ---- #include <Benchmark/Benchmark-DLLoader.h> ! #include <UI/UI-Console.h> #include <iostream> *************** *** 46,50 **** if (!cbmUI) ! cbmUI=new CBM::UI; tmp_bm=PREFIX; --- 46,50 ---- if (!cbmUI) ! cbmUI=new CBM::UIConsole; tmp_bm=PREFIX; *************** *** 55,58 **** --- 55,59 ---- CBM::cbmlib_paths.push_back(tmp_bm); CBM::cbmlib_paths.push_back("./SupportedBenchmarks/.libs"); + CBM::cbmlib_paths.push_back("../SupportedBenchmarks/.libs"); CBM::cbmlib_paths.push_back("../../SupportedBenchmarks/.libs"); *************** *** 77,82 **** if (!checkDirectory(dir)) { ! cbmUI->Information(CBM::UI::DirectoryCreate, ! dir); r=mkdir(dir); --- 78,83 ---- if (!checkDirectory(dir)) { ! cbmUI->msgCreate(UIMsg::Directory, ! dir); r=mkdir(dir); *************** *** 85,90 **** std::string msg = "Can't create "; msg+=dir; ! cbmUI->Fatal(msg); ! } } --- 86,92 ---- std::string msg = "Can't create "; msg+=dir; ! cbmUI->outputKO(msg); ! } else ! cbmUI->outputOK(); } *************** *** 114,118 **** cmd+=localfile; ! exec0(cmd); return(1); } --- 116,121 ---- cmd+=localfile; ! system(cmd.c_str()); ! // exec0(cmd); return(1); } *************** *** 126,131 **** ! cbmUI->Information(CBM::UI::PackageDownload, ! url); T.Start(); --- 129,133 ---- ! cbmUI->msgDownload(url); T.Start(); *************** *** 133,142 **** while (!T.Terminated()) { sleep(1); ! cbmUI->Information(CBM::UI::PackageDownload, ! CBM::UI::Running, ! T.Progress()); } ! cbmUI->Information(CBM::UI::PackageDownload, ! CBM::UI::OK); return(1); } --- 135,141 ---- while (!T.Terminated()) { sleep(1); ! cbmUI->Progress(T.Progress()); } ! cbmUI->outputOK(); return(1); } *************** *** 459,463 **** if (r == "") { ! cbmUI->Fatal("No such external program"); } --- 458,462 ---- if (r == "") { ! cbmUI->msgFatal("No such external program"); } *************** *** 530,536 **** } else { std::string str; ! str="Invalid MD5 for "; str+=filename; ! cbmUI->Fatal(str); result=""; } --- 529,535 ---- } else { std::string str; ! str="Can't compute MD5 for "; str+=filename; ! cbmUI->outputInfo(str); result=""; } |
From: Frederic T. <xf...@us...> - 2007-06-06 15:55:44
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9306 Modified Files: Makefile.am Log Message: XML based message reporting (new files added). Index: Makefile.am =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 22 Jan 2007 18:25:23 -0000 1.2 --- Makefile.am 6 Jun 2007 15:55:41 -0000 1.3 *************** *** 10,14 **** noinst_LTLIBRARIES = libUI.la ! sources = UI.cpp libUI_la_SOURCES = $(sources) --- 10,14 ---- noinst_LTLIBRARIES = libUI.la ! sources = UI-Msg.cpp UI.cpp UI-Console.cpp libUI_la_SOURCES = $(sources) |
From: Frederic T. <xf...@us...> - 2007-06-06 15:55:11
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9115 Modified Files: UI.cpp UI.h Log Message: XML based message reporting. Index: UI.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UI.h 23 May 2007 18:25:00 -0000 1.6 --- UI.h 6 Jun 2007 15:55:07 -0000 1.7 *************** *** 10,14 **** #define H_CBMUI ! #include <string> namespace CBM { --- 10,14 ---- #define H_CBMUI ! #include <UI/UI-Msg.h> namespace CBM { *************** *** 21,90 **** { private: ! std::string msg; ! float progressLast; ! protected: ! public: ! UI(); ! ! /** Typedef for message sent to UI object. */ ! typedef enum Info { FileCreate, /*!< File creation */ ! FileRead, /*!< File is being read */ ! FileWrite, /*!< File has been written */ ! FileRemove, /*!< File has been removed */ ! Checksum, /*!< Checksum related messages */ ! DirectoryCreate, /*!< Directory has been created */ ! PackageDownload, /*!< Package download */ ! PackageExtract, /*!< Package extract */ ! PackagePatch, /*!< Package patching */ ! PackagePreconfigure, /*!< Package pre-configuration */ ! PackageConfigure, /*!< Package configuration */ ! PackageMake, /*!< Package building */ ! PackageTest, /*!< Package testing */ ! BenchBench, /*!< Benchmark ran */ ! BenchResult, /*!< Benchmark result is being ! * displayed */ ! PackageClean, /*!< Package cleaning */ ! PackageUninstall, /*!< Package uninstallation */ ! CompilerAutodetect /*!< Autodetect compilers */ ! }; ! typedef enum State { ! Start, Running, OK, Failed ! }; ! /** Throws a fatal error. ! Display a message and exits properly. ! \sa CBMSystem::done() ! \return 1 if ok. ! */ ! virtual int Fatal(std::string msg); ! /** Display information. ! Prints an header corresponding to the type, then shows msg. ! \param type Type of information ! \param msg Message (clear text) to display ! */ ! virtual std::string LastMessage(void); ! virtual float LastProgress(void); ! virtual int Information(Info type, ! std::string _msg, ! State state = Start, ! float _progress = 0); ! virtual int Information(Info type, ! State state = Start, ! float _progress = 0); - virtual void InformationBenchmarkResult(std::string _bid, - std::string _xtime, - std::string _r); ! /* ! virtual void ProgressInit(std::string msg); ! virtual void Progress(float _p); ! virtual void ProgressDone(void); ! */ /** Virtual destructor */ --- 21,66 ---- { private: ! UIMsg *root; ! UIMsg *current; ! virtual UIMsg *currentMsg(void); ! protected: ! /** Checks if in main thread ! */ ! virtual void postMsg(UIMsg *_msg); ! virtual void childDone(void); ! public: ! UI(); ! virtual UIMsg *msgFatal(std::string _text); ! virtual UIMsg *msgShell(std::string _shellCommand); ! virtual UIMsg *msgCreate(UIMsg::ObjectType _type, ! std::string _name); ! virtual UIMsg *msgDownload(std::string _url); ! virtual UIMsg *msgChecksum(std::string _file); ! virtual UIMsg *msgExtract(std::string _name); ! virtual UIMsg *msgPatch(std::string _name); ! virtual UIMsg *msgPreconfigure(std::string _name); ! virtual UIMsg *msgConfigure(std::string _info); ! virtual UIMsg *msgMake(std::string _name); ! virtual UIMsg *msgTest(std::string _name); ! virtual UIMsg *msgRelease(std::string _name); ! virtual UIMsg *msgInstall(std::string _name); ! virtual UIMsg *msgFetch(std::string _name); ! virtual UIMsg *msgUninstall(std::string _name); ! virtual UIMsg *msgBench(std::string _name); ! virtual UIMsg *outputInfo(std::string _text); ! virtual UIMsg *Progress(float _pc); ! /** Call childDone() */ ! virtual UIMsg *outputOK(std::string _test = ""); ! virtual UIMsg *outputKO(std::string _test = ""); ! virtual void Display(UIMsg *_msg) = 0; ! virtual void DisplayProgressUpdate(UIMsg *_msg) = 0; ! virtual void DisplayDone(UIMsg *_msg) = 0; /** Virtual destructor */ Index: UI.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UI.cpp 23 May 2007 18:25:00 -0000 1.7 --- UI.cpp 6 Jun 2007 15:55:07 -0000 1.8 *************** *** 9,12 **** --- 9,13 ---- #include <UI/UI.h> #include <System/System.h> + #include <Base/Thread.h> #include <libcompbenchmarks.h> *************** *** 16,21 **** using namespace CBM; ! CBM::UI *CBM::cbmUI = 0; ! CBM::UI *CBM::cbmUI_old = 0; UI::UI() --- 17,23 ---- using namespace CBM; ! CBM::UI *CBM::cbmUI = 0; ! CBM::UI *CBM::cbmUI_old = 0; ! pthread_t ui_main_thread = currentThread(); UI::UI() *************** *** 26,203 **** cbmUI=this; ! msg=""; ! progressLast=0; } ! int UI::Fatal(std::string msg) { ! std::cerr << "FATAL ERROR: " << msg << std::endl; ! if (UO_fatal) { ! CBM::cbmSystem->done(); ! exit(1); } ! return(1); } ! std::string UI::LastMessage(void) { return(msg); } ! float UI::LastProgress(void) { ! return(progressLast); } ! int UI::Information(CBM::UI::Info type, ! std::string _msg, ! State state, ! float _progress) { ! std::string what; ! if (!UO_verbose) ! return(1); ! switch(type) { ! case FileCreate: ! what="Creating file"; ! break; ! case FileRead: ! what="Reading"; ! break; ! case FileWrite: ! what="Writing"; ! break; ! case FileRemove: ! what="Removing"; ! break; ! case Checksum: ! what="MD5 Checksum verification"; ! break; ! case DirectoryCreate: ! what="Creating directory"; ! break; ! case PackageDownload: ! what="Downloading"; ! break; ! case PackageExtract: ! what="Extracting"; ! break; ! case PackagePatch: ! what="Patching"; ! break; ! case PackagePreconfigure: ! what="Preconfiguring"; ! break; ! case PackageConfigure: ! what="Configuring"; ! break; ! case PackageTest: ! what="Testing"; ! break; ! case PackageMake: ! what="Making"; ! break; ! case BenchBench: ! what="Running benchmark"; ! break; ! case BenchResult: ! what="Benchmark result :"; ! break; ! case PackageClean: ! what="Cleaning"; ! break; ! case PackageUninstall: ! what="Uninstalling"; ! break; ! case CompilerAutodetect: ! what="Compiler autodetection"; ! default: ! what="(?)"; ! } ! msg=_msg; ! if (state==Running) { ! float n = _progress-progressLast; ! float np = progressLast; ! float i; ! n/=5.0; ! for(i=0; i<n; i+=1.0) { ! printf("="); ! np+=1.0; ! } ! progressLast=np; ! fflush(stdout); ! } else { ! std::string dum; ! switch(state) { ! case Start: ! dum="Starting"; ! break; ! case Running: ! dum="Running"; ! break; ! case OK: ! dum="OK"; ! break; ! case Failed: ! dum="Failed"; ! break; ! default: ! dum="??? <internal error>"; ! break; ! } ! if (progressLast!=0) { ! std::cout << std::endl; ! progressLast=0; ! } ! std::cout << msg << " " << what << " " << dum << std::endl; ! } ! return(1); } ! int UI::Information(CBM::UI::Info type, ! State state, ! float _progress) { ! return(Information(type, msg, state, _progress)); } ! void UI::InformationBenchmarkResult(std::string _bid, ! std::string _xtime, ! std::string _r) { ! std::cout << _bid << " Execution time (s) : " << _xtime << std::endl; ! std::cout << _bid << " Measured (higher is better) : " << _r << std::endl; } ! /* ! void UI::ProgressInit(std::string msg) { ! progressMsg=msg; ! printf("%s : ", progressMsg.c_str()); } ! void UI::Progress(float _p) { } ! void UI::ProgressDone(void) { ! Progress(100.0); ! printf(" - done.\n"); } - */ UI::~UI() { if (cbmUI_old) cbmUI=cbmUI_old; --- 28,263 ---- cbmUI=this; ! root=new UIMsg(); ! current=0; } ! UIMsg *UI::currentMsg(void) { ! return(current); ! } ! ! void UI::postMsg(UIMsg *_msg) ! { ! if (ui_main_thread!=currentThread()) { ! std::cerr << "BUG : UI::postMsg() used in another thread.\n" << std::endl; ! std::cerr << "BUG : here's message : " << std::endl; ! std::cerr << _msg->str() << std::endl; ! return; } ! ! if (!current) ! current=root; ! else ! current->addChild(_msg); ! ! current=_msg; ! Display(current); } ! void UI::childDone(void) ! { ! if (current) { ! DisplayDone(current); ! if (current->getParent()) ! current=(UIMsg*)current->getParent()->getParent(); ! else ! current=0; ! } ! } ! ! UIMsg *UI::msgFatal(std::string _text) { + UIMsg *msg = new UIMsgFatal(_text); + postMsg(msg); + msg->outputKO(); + + childDone(); + return(msg); } ! UIMsg *UI::msgShell(std::string _shellCommand) { ! UIMsg *msg = new UIMsgShell(_shellCommand); ! postMsg(msg); ! ! return(msg); } + UIMsg *UI::msgCreate(UIMsg::ObjectType _type, + std::string _name) + { + UIMsg *msg = new UIMsgCreate(_type, _name); + postMsg(msg); + + return(msg); + } ! UIMsg *UI::msgDownload(std::string _url) { ! UIMsg *msg = new UIMsgDownload(_url); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgChecksum(std::string _file) ! { ! UIMsg *msg = new UIMsgChecksum(_file); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgExtract(std::string _name) ! { ! UIMsg *msg = new UIMsgExtract(_name); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgPatch(std::string _name) ! { ! UIMsg *msg = new UIMsgPatch(_name); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgPreconfigure(std::string _name) ! { ! UIMsg *msg = new UIMsgPreconfigure(_name); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgConfigure(std::string _name) ! { ! UIMsg *msg = new UIMsgConfigure(_name); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgMake(std::string _name) ! { ! UIMsg *msg = new UIMsgMake(_name); ! postMsg(msg); ! ! return(msg); ! } ! UIMsg *UI::msgTest(std::string _name) ! { ! UIMsg *msg = new UIMsgTest(_name); ! postMsg(msg); ! ! return(msg); } ! UIMsg *UI::msgRelease(std::string _name) { ! UIMsg *msg = new UIMsgRelease(_name); ! postMsg(msg); ! ! return(msg); } ! UIMsg *UI::msgInstall(std::string _name) { ! UIMsg *msg = new UIMsgInstall(_name); ! postMsg(msg); ! ! return(msg); } ! UIMsg *UI::msgFetch(std::string _name) { ! UIMsg *msg = new UIMsgFetch(_name); ! postMsg(msg); ! ! return(msg); } ! UIMsg *UI::msgUninstall(std::string _name) { + UIMsg *msg = new UIMsgUninstall(_name); + postMsg(msg); + + return(msg); + } + UIMsg *UI::msgBench(std::string _name) + { + UIMsg *msg = new UIMsgBench(_name); + postMsg(msg); + + return(msg); } ! UIMsg *UI::outputInfo(std::string _test) { ! UIMsg *msg = currentMsg(); ! ! msg->outputInfo(_test); ! ! return(msg); } + UIMsg *UI::Progress(float _pc) + { + UIMsg *msg = currentMsg(); + + msg->setProgress(_pc); + DisplayProgressUpdate(msg); + + return(msg); + } + + UIMsg *UI::outputOK(std::string _test) + { + UIMsg *msg = currentMsg(); + + msg->outputOK(_test); + + childDone(); + + return(msg); + } + + UIMsg *UI::outputKO(std::string _test) + { + UIMsg *msg = currentMsg(); + + msg->outputKO(_test); + + childDone(); + + return(msg); + } + + /* + void UI::display(UIMsg *_msg) + { + std::cout << _msg->str(); + } + + void UI::displayProgressUpdate(UIMsg *_msg) + { + } + + void UI::displayDone(UIMsg *_msg) + { + std::cout << std::endl; + } + */ UI::~UI() { + if (root) + delete(root); + if (cbmUI_old) cbmUI=cbmUI_old; |
From: Frederic T. <xf...@us...> - 2007-06-06 15:54:44
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8901 Added Files: UI-Console.cpp UI-Console.h UI-Msg.cpp UI-Msg.h Log Message: First import. --- NEW FILE: UI-Console.h --- /* ---------------------------------------------------------------------------- $Id: UI-Console.h,v 1.1 2007/06/06 15:54:38 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMUI_CONSOLE #define H_CBMUI_CONSOLE #include <UI/UI.h> namespace CBM { /** \brief Basic API for user interface. * * This class defines few methods to interact with compbenchmarks-config, or * with the console. */ class UIConsole : public UI { private: std::string curmsg; int lastisLF; virtual void LF(void); protected: virtual int depth(UIMsg *_msg); virtual UIMsg::Flags flags(UIMsg *_msg); virtual float progress(UIMsg *_msg); virtual UIMsg::ActionType action(UIMsg *_msg); virtual std::string objectField(UIMsg *_msg, std::string _field); virtual int childNumber(UIMsg *_msg); public: UIConsole(); virtual void Display(UIMsg *_msg); virtual void DisplayProgressUpdate(UIMsg *_msg); virtual void DisplayDone(UIMsg *_msg); virtual ~UIConsole(); }; } #endif --- NEW FILE: UI-Console.cpp --- /* ---------------------------------------------------------------------------- $Id: UI-Console.cpp,v 1.1 2007/06/06 15:54:38 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #include <UI/UI-Console.h> #include <iostream> #include <stdlib.h> using namespace CBM; int uiconsole_verbose_shell = 0; UIConsole::UIConsole() : UI() { lastisLF=0; } void UIConsole::LF(void) { if (!lastisLF) { std::cout << std::endl; lastisLF=1; } } int UIConsole::depth(UIMsg *_msg) { int d = 0; while ((_msg) && (_msg->getParent())) { _msg=(UIMsg*)_msg->getParent()->getParent(); if ((uiconsole_verbose_shell) || (action(_msg)!=UIMsg::ShellCommand)) d++; } return(d); } UIMsg::Flags UIConsole::flags(UIMsg *_msg) { XMLAttribute *A = _msg->getAttribute("flags"); if (A->Value()=="Progress") return(UIMsg::Progress); else return(UIMsg::NoProgress); } float UIConsole::progress(UIMsg *_msg) { XMLNode *N = _msg->getNode("progress"); XMLAttribute *A; if (!N) return(0.0f); A=N->getAttribute("value"); if (!A) return(0.0f); return((float)atof(A->Value().c_str())); } UIMsg::ActionType UIConsole::action(UIMsg *_msg) { XMLNode *N = _msg->getNode("action"); XMLAttribute *A; UIMsg::ActionType r; if (!N) return(UIMsg::UndefAction); A=N->getAttribute("type"); if (!A) return(UIMsg::UndefAction); r=(UIMsg::ActionType)atoi(A->Value().c_str()); return(r); } std::string UIConsole::objectField(UIMsg *_msg, std::string _field) { XMLNode *N = _msg->getNode("object"); XMLAttribute *A; if (!N) return(""); A=N->getAttribute(_field); if (!A) return(""); return(A->Value()); } int UIConsole::childNumber(UIMsg *_msg) { XMLNode *R = _msg->getNode("childs"); int i, n = R->nodeNumber(); int r = 0; XMLNode *N; for(i=0;i<n;i++) { N=R->getNode(i); if ((uiconsole_verbose_shell) || (action((UIMsg*)N)!=UIMsg::ShellCommand)) r++; } return(r); } void UIConsole::Display(UIMsg *_msg) { int d = depth(_msg); if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; if ((_msg->getParent()) && (_msg->getParent()->getParent())) { LF(); } curmsg=""; while (d--) curmsg+=" "; switch(action(_msg)) { case UIMsg::ShellCommand: curmsg+="Executing : '"; curmsg+=objectField(_msg, "name"); curmsg+="'"; break; case UIMsg::BenchmarkBench: curmsg+="Benchmarking "; break; case UIMsg::PackageUninstall: curmsg+="Uninstalling "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackageInstall: curmsg+="Installing "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackageDownload: curmsg+="Downloading "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackageExtract: curmsg+="Extracting "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackagePreconfigure: curmsg+="Pre-configure "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackageFetch: curmsg+="Fetching "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackageTest: curmsg+="Testing "; curmsg+=objectField(_msg, "name"); break; case UIMsg::PackagePatch: curmsg+="Patching "; curmsg+=objectField(_msg, "name"); break; case UIMsg::Checksum: curmsg+="Checksuming "; curmsg+=objectField(_msg, "name"); break; default: curmsg+="Display::DEFAULT/"; curmsg+=_msg->str(); curmsg+="\n"; break; } curmsg+=" : "; std::cout << curmsg; lastisLF=0; fflush(stdout); } void UIConsole::DisplayProgressUpdate(UIMsg *_msg) { if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; printf("\r%s%0.2f%%", curmsg.c_str(), progress(_msg)); fflush(stdout); } void UIConsole::DisplayDone(UIMsg *_msg) { XMLNode *R = _msg->getNode("output"); XMLNode *N; XMLAttribute *A; UIMsg::Status status; int i, n = R->nodeNumber(); int d = depth(_msg); int s; // std::cout << _msg->str() << std::endl; if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; for(i=0;i<n;i++) { N=R->getNode(i); if (N->Name()!="text") continue; A=N->getAttribute("status"); if (!A) continue; status=(UIMsg::Status)atoi(A->Value().c_str()); if (childNumber(_msg)) { s=d+1; while (s--) std::cout << " "; } if (flags(_msg)==UIMsg::Progress) { if ((status==UIMsg::OK) && (progress(_msg)!=100.0)) { _msg->setProgress(100.0); } std::cout << " - "; } switch(status) { case UIMsg::OK: std::cout << "OK"; lastisLF=0; break; case UIMsg::KO: std::cout << "Failed."; lastisLF=0; break; case UIMsg::Info: std::cout << N->Value(); lastisLF=0; break; } LF(); } // lastisLF=0; } UIConsole::~UIConsole() { } --- NEW FILE: UI-Msg.h --- /* ---------------------------------------------------------------------------- $Id: UI-Msg.h,v 1.1 2007/06/06 15:54:38 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMUIMSG #define H_CBMUIMSG #include <Base/XML.h> /* <msg timestamp="..." flags="[No]Progress> <object type="4" name="file.tar.gz"/> <action type="4"/> <output> <text status="info">Blah</text> <text status="ok"/> </output> <progress [value="4"]> <childs/> </msg> */ namespace CBM { class UIMsg : public XMLNode { public: typedef enum Flags { NoProgress, Progress }; typedef enum Status { KO, OK, Info }; typedef enum ObjectType { UndefObject, FatalError, Shell, File, Directory, Package, Benchmark, Compiler }; typedef enum ActionType { UndefAction, ShellCommand, Create, Read, Write, Remove, Checksum, PackageInstall, PackageUninstall, PackageFetch, PackageDownload, PackageExtract, PackagePatch, PackagePreconfigure, PackageConfigure, PackageMake, PackageTest, PackageClean, BenchmarkBench, BenchmarkResult, CompilerAutodetect }; private: XMLNode *outputNode; XMLNode *progressNode; XMLNode *childsNode; virtual std::string toString(int _i); virtual std::string toString(float _f); protected: virtual void addObject(ObjectType _type, std::string _name); virtual void addAction(ActionType _type, std::string _action = ""); virtual void addOutput(Status _status, std::string _text = ""); public: UIMsg(Flags _flags = NoProgress); virtual void addChild(UIMsg *_child); virtual void outputOK(std::string _text = ""); virtual void outputKO(std::string _text = ""); virtual void outputInfo(std::string _text); virtual void setProgress(float _pc); virtual ~UIMsg(); }; class UIMsgFatal : public UIMsg { public: UIMsgFatal(std::string _text); virtual ~UIMsgFatal(); }; class UIMsgShell : public UIMsg { public: UIMsgShell(std::string _shellCommand); virtual ~UIMsgShell(); }; class UIMsgCreate : public UIMsg { private: protected: public: UIMsgCreate(ObjectType _type, std::string _name); virtual ~UIMsgCreate(); }; class UIMsgDownload : public UIMsg { public: UIMsgDownload(std::string _url); virtual ~UIMsgDownload(); }; class UIMsgChecksum : public UIMsg { public: UIMsgChecksum(std::string _file); virtual ~UIMsgChecksum(); }; class UIMsgExtract : public UIMsg { public: UIMsgExtract(std::string _name); virtual ~UIMsgExtract(); }; class UIMsgPatch : public UIMsg { public: UIMsgPatch(std::string _name); virtual ~UIMsgPatch(); }; class UIMsgPreconfigure : public UIMsg { public: UIMsgPreconfigure(std::string _name); virtual ~UIMsgPreconfigure(); }; class UIMsgConfigure : public UIMsg { public: UIMsgConfigure(std::string _info); virtual ~UIMsgConfigure(); }; class UIMsgMake : public UIMsg { public: UIMsgMake(std::string _name); virtual ~UIMsgMake(); }; class UIMsgTest : public UIMsg { public: UIMsgTest(std::string _name); virtual ~UIMsgTest(); }; class UIMsgRelease : public UIMsg { public: UIMsgRelease(std::string _name); virtual ~UIMsgRelease(); }; class UIMsgInstall : public UIMsg { public: UIMsgInstall(std::string _name); virtual ~UIMsgInstall(); }; class UIMsgFetch : public UIMsg { public: UIMsgFetch(std::string _name); virtual ~UIMsgFetch(); }; class UIMsgUninstall : public UIMsg { public: UIMsgUninstall(std::string _name); virtual ~UIMsgUninstall(); }; class UIMsgBench : public UIMsg { public: UIMsgBench(std::string _name); virtual ~UIMsgBench(); }; } #endif --- NEW FILE: UI-Msg.cpp --- /* ---------------------------------------------------------------------------- $Id: UI-Msg.cpp,v 1.1 2007/06/06 15:54:38 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #include <UI/UI-Msg.h> #include <stdio.h> using namespace CBM; UIMsg::UIMsg(Flags _flags) : XMLNode("msg") { if (_flags == NoProgress) addAttribute("flags", "NoProgress"); if (_flags == Progress) addAttribute("flags", "Progress"); outputNode=addNode("output"); progressNode=addNode("progress"); childsNode=addNode("childs"); } std::string UIMsg::toString(int _i) { char tmp[16] = { 0 }; sprintf(tmp, "%d", _i); return(tmp); } std::string UIMsg::toString(float _f) { char tmp[32] = { 0 }; sprintf(tmp, "%f", _f); return(tmp); } void UIMsg::addObject(ObjectType _type, std::string _name) { XMLNode *O = new XMLNode("object"); O->addAttribute("type", toString((int) _type)); O->addAttribute("name", _name); add(O); } void UIMsg::addAction(ActionType _type, std::string _action) { XMLNode *O = new XMLNode("action"); O->addAttribute("type", toString((int) _type)); if (_action!="") { O->addAttribute("name", _action); } add(O); } void UIMsg::addOutput(Status _status, std::string _text) { XMLNode *O = new XMLNode("text"); O->addAttribute("status", toString((int) _status)); if (_text!="") O->setValue(_text); outputNode->add(O); } void UIMsg::addChild(UIMsg *_child) { childsNode->add(_child); } void UIMsg::outputOK(std::string _text) { addOutput(OK, _text); } void UIMsg::outputKO(std::string _text) { addOutput(KO, _text); } void UIMsg::outputInfo(std::string _text) { addOutput(Info, _text); } void UIMsg::setProgress(float _pc) { XMLAttribute *A = progressNode->getAttribute("value"); if (!A) A=progressNode->addAttribute("value", "0"); A->setValue(toString(_pc)); } UIMsg::~UIMsg() { } UIMsgFatal::UIMsgFatal(std::string _text) : UIMsg() { addObject(FatalError, _text); } UIMsgFatal::~UIMsgFatal() { } UIMsgShell::UIMsgShell(std::string _shellCommand) : UIMsg() { addObject(Shell, _shellCommand); addAction(ShellCommand); } UIMsgShell::~UIMsgShell() { } UIMsgCreate::UIMsgCreate(ObjectType _type, std::string _name) : UIMsg() { addObject(_type, _name); addAction(Create); } UIMsgCreate::~UIMsgCreate() { } UIMsgDownload::UIMsgDownload(std::string _url) : UIMsg(Progress) { addObject(File, _url); addAction(PackageDownload); } UIMsgDownload::~UIMsgDownload() { } UIMsgChecksum::UIMsgChecksum(std::string _file) : UIMsg() { addObject(File, _file); addAction(Checksum); } UIMsgChecksum::~UIMsgChecksum() { } UIMsgExtract::UIMsgExtract(std::string _name) : UIMsg() { addObject(Package, _name); addAction(PackageExtract); } UIMsgExtract::~UIMsgExtract() { } UIMsgPatch::UIMsgPatch(std::string _name) : UIMsg() { addObject(Package, _name); addAction(PackagePatch); } UIMsgPatch::~UIMsgPatch() { } UIMsgPreconfigure::UIMsgPreconfigure(std::string _name) : UIMsg(Progress) { addObject(Package, _name); addAction(PackagePreconfigure); } UIMsgPreconfigure::~UIMsgPreconfigure() { } UIMsgConfigure::UIMsgConfigure(std::string _info) : UIMsg() { addObject(Package, _info); addAction(PackageConfigure); } UIMsgConfigure::~UIMsgConfigure() { } UIMsgMake::UIMsgMake(std::string _info) : UIMsg() { addObject(Package, _info); addAction(PackageMake); } UIMsgMake::~UIMsgMake() { } UIMsgTest::UIMsgTest(std::string _info) : UIMsg() { addObject(Package, _info); addAction(PackageTest); } UIMsgTest::~UIMsgTest() { } UIMsgRelease::UIMsgRelease(std::string _info) : UIMsg() { addObject(Package, _info); addAction(PackageClean); } UIMsgRelease::~UIMsgRelease() { } UIMsgInstall::UIMsgInstall(std::string _info) : UIMsg() { addObject(Package, _info); addAction(PackageInstall); } UIMsgInstall::~UIMsgInstall() { } UIMsgFetch::UIMsgFetch(std::string _name) : UIMsg() { addObject(Package, _name); addAction(PackageFetch); } UIMsgFetch::~UIMsgFetch() { } UIMsgUninstall::UIMsgUninstall(std::string _name) : UIMsg() { addObject(Package, _name); addAction(PackageUninstall); } UIMsgUninstall::~UIMsgUninstall() { } UIMsgBench::UIMsgBench(std::string _name) : UIMsg() { addObject(Benchmark, _name); addAction(BenchmarkBench); } UIMsgBench::~UIMsgBench() { } |
From: Frederic T. <xf...@us...> - 2007-05-30 19:27:51
|
Update of /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3214 Modified Files: cloptions.cpp Log Message: CBM::Benchmark instances handling. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan/cloptions.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cloptions.cpp 30 May 2007 17:08:49 -0000 1.3 --- cloptions.cpp 30 May 2007 19:27:46 -0000 1.4 *************** *** 13,16 **** --- 13,17 ---- #include <Compiler/Compiler.h> #include <Compiler/Compiler-OptionSet.h> + #include <Benchmark/Benchmark.h> #include <UI/UI.h> *************** *** 32,36 **** ActionRegisterCompiler, ActionUnregisterCompiler, ActionListCompiler, ActionRegisterOptionset, ActionUnregisterOptionset, ActionListOptionset, ! ActionRegisterOptions, ActionUnregisterOptions, ActionListOptions } OptAction; --- 33,38 ---- ActionRegisterCompiler, ActionUnregisterCompiler, ActionListCompiler, ActionRegisterOptionset, ActionUnregisterOptionset, ActionListOptionset, ! ActionRegisterOptions, ActionUnregisterOptions, ActionListOptions, ! ActionRegisterBenchmark, ActionUnregisterBenchmark, ActionListBenchmark } OptAction; *************** *** 45,49 **** void cbmOptionsHelp(void) { ! std::cout << "Usage: compbenchmarks-core [OPTIONS]" << std::endl << "Plan management :" << std::endl << " --plan-register <file> [--default] : Create file[.xml] plan." << std::endl --- 47,51 ---- void cbmOptionsHelp(void) { ! std::cout << "Usage: compbenchmarks-plan [OPTIONS]" << std::endl << "Plan management :" << std::endl << " --plan-register <file> [--default] : Create file[.xml] plan." << std::endl *************** *** 135,138 **** --- 137,150 ---- } + CBM::Benchmark *getBenchmark(std::string id) + { + CBM::Benchmark *r = cbmSystem->Benchmark(id); + + if (!r) { + std::cerr << "No valid benchmark provided. See compbenchmarks-core -qib." << std::endl; + } + return(r); + } + int cbmPlanOptionsParse(int argc, char *argv[]) { *************** *** 149,159 **** std::string optionsName; std::string options; ! CBM::Plan *P = 0; ! CBM::PlanBatch *B = 0; CBM::CompilerSelector *CS = 0; CBM::Compiler *C = 0; CBM::CompilerOptionSet *OS = 0; CBM::CompilerOptions *O = 0; int i, n; --- 161,173 ---- std::string optionsName; std::string options; + std::string benchmarkName; ! CBM::Plan *P = 0; ! CBM::PlanBatch *B = 0; CBM::CompilerSelector *CS = 0; CBM::Compiler *C = 0; CBM::CompilerOptionSet *OS = 0; CBM::CompilerOptions *O = 0; + CBM::Benchmark *BM = 0; int i, n; *************** *** 186,189 **** --- 200,207 ---- {"options-list", no_argument, 0, 5003}, + {"benchmark-register", required_argument, 0, 6001}, + {"benchmark-unregister", required_argument, 0, 6002}, + {"benchmark-list", no_argument, 0, 6003}, + { 0, 0, 0, 0 } }; *************** *** 281,284 **** --- 299,313 ---- action=ActionListOptions; break; + case 6001: + action=ActionRegisterBenchmark; + benchmarkName=optarg; + break; + case 6002: + action=ActionUnregisterBenchmark; + benchmarkName=optarg; + break; + case 6003: + action=ActionListBenchmark; + break; default: case '?': *************** *** 581,585 **** delete(P); break; - case ActionRegisterOptions: if (!getPlanFileName(planFileName)) --- 610,613 ---- *************** *** 687,690 **** --- 715,818 ---- break; + case ActionRegisterBenchmark: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + BM=getBenchmark(benchmarkName); + if (!BM) + break; + + if (B->add(BM)) { + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << BM->Name() << " added in " << B->Id() << std::endl; + } else { + std::cerr << BM->Name() << " can't be added." << std::endl; + } + } else { + std::cerr << benchmarkName << " can't be added; see ./compbenchmarks-core -qib" << std::endl; + std::cerr << "Possible causes are either that " << BM->Name() << " is already present" + << "in that plan or not fully installed." << std::endl; + } + delete(BM); + delete(P); + break; + + case ActionUnregisterBenchmark: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + BM=getBenchmark(benchmarkName); + if (!BM) + break; + + if (B->remove(BM)) { + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << BM->Name() << " removed from " << B->Id() << std::endl; + } else { + std::cerr << BM->Name() << " can't be removed." << std::endl; + } + } else { + std::cerr << benchmarkName << " can't be removed; see ./compbenchmarks-core -qib" << std::endl; + } + delete(BM); + delete(P); + break; + + + case ActionListBenchmark: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + n=B->benchmarkNumber(); + if (!n) { + std::cout << "No benchmark registered." << std::endl; + } else { + printf("%d benchmark(s) found :\n", n); + + for(i=0; i<n; i++) { + BM=B->getBenchmark(i); + std::cout << " * " << BM->Name() << std::endl; + } + } + delete(P); + break; default: printf("?\n"); |
From: Frederic T. <xf...@us...> - 2007-05-30 17:09:51
|
Update of /cvsroot/compbench/CompBenchmarks++/compbenchmarks-core In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17181 Modified Files: cloptions.cpp Log Message: Further help provided after a package's fetch. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/compbenchmarks-core/cloptions.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cloptions.cpp 27 May 2007 16:06:19 -0000 1.1 --- cloptions.cpp 30 May 2007 17:09:48 -0000 1.2 *************** *** 742,746 **** break; case ActionLLFetch: ! P->Fetch((char*) tarball.c_str(), UO_force); break; case ActionLLExtract: --- 742,748 ---- break; case ActionLLFetch: ! if (P->Fetch((char*) tarball.c_str(), UO_force)) { ! std::cout << "Done. You can now use -m -I " << P->Name() << " to finish installation." << std::endl; ! } break; case ActionLLExtract: |
From: Frederic T. <xf...@us...> - 2007-05-30 17:09:03
|
Update of /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16815 Modified Files: cloptions.cpp Log Message: CBM::OptionSet and CBM::Options handling. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan/cloptions.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cloptions.cpp 29 May 2007 18:26:11 -0000 1.2 --- cloptions.cpp 30 May 2007 17:08:49 -0000 1.3 *************** *** 31,35 **** ActionRegisterBatch, ActionUnregisterBatch, ActionListBatch, ActionRegisterCompiler, ActionUnregisterCompiler, ActionListCompiler, ! ActionRegisterOptionset, ActionUnregisterOptionset, ActionListOptionset } OptAction; --- 31,36 ---- ActionRegisterBatch, ActionUnregisterBatch, ActionListBatch, ActionRegisterCompiler, ActionUnregisterCompiler, ActionListCompiler, ! ActionRegisterOptionset, ActionUnregisterOptionset, ActionListOptionset, ! ActionRegisterOptions, ActionUnregisterOptions, ActionListOptions } OptAction; *************** *** 123,126 **** --- 124,138 ---- } + CBM::CompilerOptionSet *getOptionSet(CBM::PlanBatch *B, + std::string optionsetName) + { + CBM::CompilerOptionSet *OS; + OS = B->getCompilerOptions(optionsetName); + if (!OS) + std::cerr << "No option set defined. Look at --optionset-use." << std::endl; + + return(OS); + } + int cbmPlanOptionsParse(int argc, char *argv[]) { *************** *** 135,138 **** --- 147,152 ---- std::string compilerName; std::string optionsetName; + std::string optionsName; + std::string options; CBM::Plan *P = 0; *************** *** 141,144 **** --- 155,159 ---- CBM::Compiler *C = 0; CBM::CompilerOptionSet *OS = 0; + CBM::CompilerOptions *O = 0; int i, n; *************** *** 165,168 **** --- 180,188 ---- {"optionset-unregister", required_argument, 0, 4002}, {"optionset-list", no_argument, 0, 4003}, + {"optionset-use", required_argument, 0, 4004}, + + {"options-register", required_argument, 0, 5001}, + {"options-unregister", required_argument, 0, 5002}, + {"options-list", no_argument, 0, 5003}, { 0, 0, 0, 0 } *************** *** 243,246 **** --- 263,284 ---- action=ActionListOptionset; break; + case 4004: + optionsetName=optarg; + break; + case 5001: + action=ActionRegisterOptions; + optionsName=optarg; + optind++; + if (optind<=argc) { + options=argv[optind-1]; + } + break; + case 5002: + action=ActionUnregisterOptions; + optionsName=optarg; + break; + case 5003: + action=ActionListOptions; + break; default: case '?': *************** *** 482,486 **** std::cerr << optionsetName << " has not been added." << std::endl; } - delete(OS); delete(P); break; --- 520,523 ---- *************** *** 502,506 **** } ! OS = new CompilerOptionSet(optionsetName); if (B->remove(OS)) { storePlan(P, planFileName); --- 539,543 ---- } ! OS = B->getCompilerOptions(optionsetName); if (B->remove(OS)) { storePlan(P, planFileName); *************** *** 512,516 **** } - delete(OS); delete(P); --- 549,552 ---- *************** *** 543,546 **** --- 579,688 ---- } } + delete(P); + break; + + case ActionRegisterOptions: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + OS = getOptionSet(B, optionsetName); + if (!OS) + break; + + O=new CBM::CompilerOptions(optionsName, options); + if (OS->add(O)) { + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << O->Id() << " added in set " << optionsetName << std::endl; + } + } else { + std::cerr << O->Id() << " has not been added." << std::endl; + } + delete(P); + break; + + case ActionUnregisterOptions: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + OS = getOptionSet(B, optionsetName); + if (!OS) + break; + + O=OS->get(optionsName); + if (O) { + if (OS->remove(O)) { + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << O->Id() << " removed from set " << optionsetName << std::endl; + } + } else { + std::cerr << O->Id() << " can't be removed." << std::endl; + } + delete(O); + } else { + std::cerr << optionsName << " has not been found." << std::endl; + } + delete(P); + break; + case ActionListOptions: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + OS = getOptionSet(B, optionsetName); + if (!OS) + break; + + + n = OS->optionNumber(); + + parseExitValue=0; + if (!n) { + std::cout << "No options registered." << std::endl; + } else { + printf("%d option line(s) found :\n", n); + for (i=0; i<n; i++) { + O=OS->Options(i); + std::cout << " * Id : " << O->Id() << " - Contains : " + << O->Options() << std::endl; + } + } + delete(P); break; |
From: Frederic T. <xf...@us...> - 2007-05-30 17:04:13
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15023 Modified Files: Plan.cpp Plan.h Log Message: removeBatch() now returns status (integer). Major changes in XML I/O (e.g. each Plan holds its own filename and there's no need anymore to hold a CBM::System wide CBM::Plan object). Index: Plan.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Plan.h 23 May 2007 15:29:46 -0000 1.7 --- Plan.h 30 May 2007 17:04:03 -0000 1.8 *************** *** 9,14 **** #define H_CBM_PLAN 1 ! #include <vector> ! #include <string> #ifdef SWIG --- 9,13 ---- #define H_CBM_PLAN 1 ! #include <Base/XML.h> #ifdef SWIG *************** *** 47,50 **** --- 46,50 ---- */ int iteration; + std::string filename; virtual CBM_PB *batchForIteration(int *it_in_plan); *************** *** 54,59 **** virtual CBM_PB *addBatch(CBM_PB *_ps); ! virtual void removeBatch(CBM_PB *_ps); ! virtual void removeBatch(std::string _id); virtual int batchNumber(void); --- 54,59 ---- virtual CBM_PB *addBatch(CBM_PB *_ps); ! virtual int removeBatch(CBM_PB *_ps); ! virtual int removeBatch(std::string _id); virtual int batchNumber(void); *************** *** 77,82 **** virtual void reset(void); ! virtual int store(void); ! virtual int restore(XMLNode *_planRootNode); virtual ~Plan(); --- 77,82 ---- virtual void reset(void); ! virtual int store(std::string _filename = ""); ! virtual int restore(std::string _filename); virtual ~Plan(); Index: Plan.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Plan.cpp 23 May 2007 15:29:46 -0000 1.10 --- Plan.cpp 30 May 2007 17:04:03 -0000 1.11 *************** *** 16,19 **** --- 16,20 ---- #include <Base/Config.h> #include <Base/XML.h> + #include <Base/XMLReader.h> #include <Base/Result.h> *************** *** 75,79 **** } ! void Plan::removeBatch(PlanBatch *_ps) { int i; --- 76,80 ---- } ! int Plan::removeBatch(PlanBatch *_ps) { int i; *************** *** 81,100 **** CBM::PlanBatch *B = 0; std::vector<CBM::PlanBatch*> nplanBatch; ! for(i=0; i<n; i++) { B=getBatch(i); if (B!=_ps) nplanBatch.push_back(B); } planBatch=nplanBatch; ! stop(); } ! void Plan::removeBatch(std::string _id) { PlanBatch *c = getBatch(_id); if (c) ! removeBatch(c); } --- 82,109 ---- CBM::PlanBatch *B = 0; std::vector<CBM::PlanBatch*> nplanBatch; ! int r = 0; ! for(i=0; i<n; i++) { B=getBatch(i); if (B!=_ps) nplanBatch.push_back(B); + else + r=1; } + delete(_ps); planBatch=nplanBatch; ! if (r) ! stop(); ! return(r); } ! int Plan::removeBatch(std::string _id) { PlanBatch *c = getBatch(_id); if (c) ! return(removeBatch(c)); ! else ! return(0); } *************** *** 199,203 **** CBM::XMLNode *Plan::XML(void) { ! XMLNode *root = new CBM::XMLNode("plan"); XMLNode *batchs = new CBM::XMLNode("plan-batchs"); XMLNode *run = new CBM::XMLNode("run"); --- 208,212 ---- CBM::XMLNode *Plan::XML(void) { ! XMLNode *root = new CBM::XMLNode("libcompbenchmarks-plan"); XMLNode *batchs = new CBM::XMLNode("plan-batchs"); XMLNode *run = new CBM::XMLNode("run"); *************** *** 242,254 **** } ! int Plan::store(void) { ! XMLNode *root = XML(); ! cbmSystem->Config()->setPlan(root); ! return(cbmSystem->storeConfiguration()); } ! int Plan::restore(XMLNode *_planRootNode) { XMLNode *PBs; --- 251,267 ---- } ! int Plan::store(std::string _filename) { ! XMLNode *root = XML(); ! std::string data = root->str(); ! delete(root); ! if (_filename!="") ! filename=_filename; ! ! return(cbmSystem->fileWrite(filename, data)); } ! int Plan::restore(std::string _filename) { XMLNode *PBs; *************** *** 258,269 **** XMLAttribute *A; int i, n; PlanBatch *pb; ! if (!_planRootNode) ! return(0); reset(); ! PBs=_planRootNode->getNode("plan-batchs"); if (!PBs) return(0); --- 271,294 ---- XMLAttribute *A; int i, n; + XMLNode *planRootNode; PlanBatch *pb; ! XMLReader r; ! ! ! filename=_filename; ! ! planRootNode=r.read(filename); ! reset(); + if (!planRootNode) + return(0); ! if (planRootNode->Name()!="libcompbenchmarks-plan") { ! return(0); ! } ! ! PBs=planRootNode->getNode("plan-batchs"); if (!PBs) return(0); *************** *** 280,288 **** } ! R=_planRootNode->getNode("run"); if (!R) return(0); ! CI=R->getNode("current-iteration"); if (!CI) return(0); --- 305,313 ---- } ! R=planRootNode->getNode("run"); if (!R) return(0); ! CI=R->getNode("iteration"); if (!CI) return(0); |
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); } |
From: Frederic T. <xf...@us...> - 2007-05-30 17:02:00
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14232 Modified Files: Compiler-OptionSet.cpp Compiler-OptionSet.h Log Message: Identifier fixed; few changes on XML I/O. Index: Compiler-OptionSet.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-OptionSet.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-OptionSet.cpp 17 May 2007 14:29:47 -0000 1.1 --- Compiler-OptionSet.cpp 30 May 2007 17:01:35 -0000 1.2 *************** *** 27,34 **** } ! CBM::CompilerOptions *CompilerOptionSet::add(void) { CBM::CompilerOptions *result; ! result=new CBM::CompilerOptions(); options.push_back(result); --- 27,48 ---- } ! CBM::CompilerOptions *CompilerOptionSet::get(std::string _id) ! { ! int i; ! int n = optionNumber(); ! CBM::CompilerOptions *O = 0; ! ! for(i=0; i<n; i++) { ! O=options[i]; ! if (O->Id() == _id) ! return(O); ! } ! return(0); ! } ! ! CBM::CompilerOptions *CompilerOptionSet::add(std::string _id) { CBM::CompilerOptions *result; ! result=new CBM::CompilerOptions(_id); options.push_back(result); *************** *** 37,40 **** --- 51,61 ---- } + CBM::CompilerOptions *CompilerOptionSet::add(CBM::CompilerOptions *_options) + { + options.push_back(_options); + + return(_options); + } + int CompilerOptionSet::remove(CBM::CompilerOptions *_options) { *************** *** 43,46 **** --- 64,68 ---- CBM::CompilerOptions *O = 0; std::vector<CBM::CompilerOptions*> noptions; + int found = 0; for(i=0; i<n; i++) { *************** *** 48,57 **** if (O != _options) noptions.push_back(O); ! else ! delete(O); } ! options=noptions; ! return(1); } --- 70,90 ---- if (O != _options) noptions.push_back(O); ! else { ! found=1; ! // delete(O); ! } } ! if (found) ! options=noptions; ! return(found); ! } + int CompilerOptionSet::remove(std::string _id) + { + CBM::CompilerOptions *O = get(_id); + if (O) + return(remove(O)); + else + return(0); } *************** *** 89,93 **** if (N->Name() != "options") continue; ! O=add(); O->restore(N); } --- 122,126 ---- if (N->Name() != "options") continue; ! O=add(""); O->restore(N); } *************** *** 99,108 **** } ! std::string CompilerOptionSet::Options(int i) { if (i<optionNumber()) ! return(options[i]->Options()); else ! return(""); } --- 132,141 ---- } ! CBM::CompilerOptions *CompilerOptionSet::Options(int i) { if (i<optionNumber()) ! return(options[i]); else ! return(0); } Index: Compiler-OptionSet.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-OptionSet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-OptionSet.h 17 May 2007 14:29:47 -0000 1.1 --- Compiler-OptionSet.h 30 May 2007 17:01:35 -0000 1.2 *************** *** 45,51 **** virtual void setId(std::string _id); ! virtual CBM_CO *add(void); virtual int remove(CBM_CO *_options); virtual XMLNode *XML(void); --- 45,56 ---- virtual void setId(std::string _id); ! virtual CBM_CO *get(std::string _id); ! ! virtual CBM_CO *add(std::string _id); ! virtual CBM_CO *add(CBM_CO *_options); virtual int remove(CBM_CO *_options); + virtual int remove(std::string _id); + virtual XMLNode *XML(void); *************** *** 53,57 **** virtual int optionNumber(void); ! virtual std::string Options(int i); virtual ~CompilerOptionSet(); --- 58,62 ---- virtual int optionNumber(void); ! virtual CBM_CO *Options(int i); virtual ~CompilerOptionSet(); |
From: Frederic T. <xf...@us...> - 2007-05-30 17:01:25
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14208 Modified Files: Compiler-Options.cpp Compiler-Options.h Log Message: Identifier introduced. Few changes on XML I/O. Index: Compiler-Options.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Options.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Compiler-Options.h 17 May 2007 14:31:13 -0000 1.3 --- Compiler-Options.h 30 May 2007 17:01:12 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- */ std::vector<CBM::CompilerOption*> options; + std::string id; protected: *************** *** 36,40 **** \param _options Options to manage in current object. */ ! CompilerOptions(std::string _options = ""); virtual CompilerOption *Option(std::string _id); --- 37,44 ---- \param _options Options to manage in current object. */ ! CompilerOptions(std::string id, ! std::string _options = ""); ! ! virtual std::string Id(void); virtual CompilerOption *Option(std::string _id); Index: Compiler-Options.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Options.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Compiler-Options.cpp 23 May 2007 18:24:03 -0000 1.4 --- Compiler-Options.cpp 30 May 2007 17:01:12 -0000 1.5 *************** *** 12,20 **** using namespace CBM; ! CompilerOptions::CompilerOptions(std::string _options) { std::string o = "!"; int i = 0; if (_options=="") return; --- 12,22 ---- using namespace CBM; ! CompilerOptions::CompilerOptions(std::string _id, ! std::string _options) { std::string o = "!"; int i = 0; + id=_id; if (_options=="") return; *************** *** 31,34 **** --- 33,41 ---- } + std::string CompilerOptions::Id(void) + { + return(id); + } + void CompilerOptions::add(CBM::CompilerOption *_option) { *************** *** 117,120 **** --- 124,129 ---- root=new XMLNode("options"); + root->addAttribute("id", Id()); + for(i=0; i<n; i++) root->add(Option(i)->XML()); *************** *** 128,139 **** int n = _from->nodeNumber(); XMLNode *N; CompilerOption *O; for(i=0; i<n; i++) { N=_from->getNode(i); if (N->Name()=="option") { ! O=new CompilerOption; ! O->restore(N); ! add(O); } } --- 137,158 ---- int n = _from->nodeNumber(); XMLNode *N; + XMLAttribute *A; CompilerOption *O; + A=_from->getAttribute("id"); + if (A) + id=A->Value(); + else + id="?"; + for(i=0; i<n; i++) { N=_from->getNode(i); if (N->Name()=="option") { ! A=N->getAttribute("id"); ! if (A) { ! O=new CompilerOption(""); ! O->restore(N); ! add(O); ! } } } *************** *** 145,148 **** while ( (O=Option(0)) ) ! delete(O); } --- 164,167 ---- while ( (O=Option(0)) ) ! remove(O); } |
From: Frederic T. <xf...@us...> - 2007-05-29 18:26:17
|
Update of /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4837 Modified Files: cloptions.cpp Log Message: Many new objects can be handled. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/compbenchmarks-plan/cloptions.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cloptions.cpp 28 May 2007 17:49:46 -0000 1.1 --- cloptions.cpp 29 May 2007 18:26:11 -0000 1.2 *************** *** 10,13 **** --- 10,16 ---- #include <Base/Config.h> #include <Plan/Plan.h> + #include <Plan/Plan-Batch.h> + #include <Compiler/Compiler.h> + #include <Compiler/Compiler-OptionSet.h> #include <UI/UI.h> *************** *** 24,28 **** typedef enum { ! ActionUndef, ActionRegisterPlan, ActionUnregisterPlan } OptAction; --- 27,35 ---- typedef enum { ! ActionUndef, ! ActionRegisterPlan, ActionUnregisterPlan, ! ActionRegisterBatch, ActionUnregisterBatch, ActionListBatch, ! ActionRegisterCompiler, ActionUnregisterCompiler, ActionListCompiler, ! ActionRegisterOptionset, ActionUnregisterOptionset, ActionListOptionset } OptAction; *************** *** 57,60 **** --- 64,126 ---- } + int getPlanFileName(std::string& planFileName) + { + if (planFileName=="") { + planFileName=cbmSystem->Config()->getDefaultPlan(); + } + + if (planFileName!="") + return(1); + else { + std::cerr << "Can't find plan. Look at --plan-use option, or set a default plan (--default)" << std::endl; + return(0); + } + } + + CBM::Plan *restorePlan(std::string planFileName) + { + CBM::Plan *P = new CBM::Plan; + int r; + + r=P->restore(planFileName); + + if (r) + return(P); + else { + delete(P); + std::cerr << "Plan file " << planFileName << " not detected." << std::endl; + return(0); + } + } + + CBM::PlanBatch *restoreBatch(CBM::Plan **P, + std::string planFileName, + std::string batchId) + { + CBM::PlanBatch *B; + + (*P)=restorePlan(planFileName); + if (*P) { + B=(*P)->getBatch(batchId); + if (!B) { + std::cerr << "Batch " << batchId << " not found in " << planFileName << std::endl; + } + + return(B); + } else { + return(0); + } + } + + int storePlan(CBM::Plan *P, std::string planFileName) + { + parseExitValue=!(P->store(planFileName)); + if (parseExitValue) { + std::cerr << "Can't write in file " << planFileName << std::endl; + } + + return(!parseExitValue); + } + int cbmPlanOptionsParse(int argc, char *argv[]) { *************** *** 64,77 **** OptFilter filter = { 0 }; /* <empty>/all/installed */ int not_done = 1; std::string planFileName; ! CBM::Plan *P; static const struct option long_options[] = { {"help", no_argument, 0, 'h' }, - {"plan-register", required_argument, 0, 'r'}, - {"plan-unregister", required_argument, 0, 'u'}, - {"default", no_argument, 0, 1003}, {"version", no_argument, 0, 'v'}, ! { 0, 0, 0, 0} }; --- 130,170 ---- OptFilter filter = { 0 }; /* <empty>/all/installed */ int not_done = 1; + std::string planFileName; ! std::string batchName; ! std::string compilerName; ! std::string optionsetName; ! ! CBM::Plan *P = 0; ! CBM::PlanBatch *B = 0; ! CBM::CompilerSelector *CS = 0; ! CBM::Compiler *C = 0; ! CBM::CompilerOptionSet *OS = 0; ! ! int i, n; static const struct option long_options[] = { {"help", no_argument, 0, 'h' }, {"version", no_argument, 0, 'v'}, ! ! {"plan-register", required_argument, 0, 1001}, ! {"plan-unregister", required_argument, 0, 1002}, ! {"plan-use", required_argument, 0, 1003}, ! {"default", no_argument, 0, 1004}, ! ! {"batch-register", required_argument, 0, 2001}, ! {"batch-unregister", required_argument, 0, 2002}, ! {"batch-list", no_argument, 0, 2003}, ! {"batch-use", required_argument, 0, 2004}, ! ! {"compiler-register", required_argument, 0, 3001}, ! {"compiler-unregister", required_argument, 0, 3002}, ! {"compiler-list", no_argument, 0, 3003}, ! ! {"optionset-register", required_argument, 0, 4001}, ! {"optionset-unregister", required_argument, 0, 4002}, ! {"optionset-list", no_argument, 0, 4003}, ! ! { 0, 0, 0, 0 } }; *************** *** 82,86 **** break; ! c = getopt_long (argc, argv, "hr:u::", long_options, &option_index); if (c==-1) { --- 175,179 ---- break; ! c = getopt_long (argc, argv, "hv", long_options, &option_index); if (c==-1) { *************** *** 93,102 **** case 'h': break; ! case 'r': action=ActionRegisterPlan; planFileName=optarg; appendXML(planFileName); break; ! case 'u': action=ActionUnregisterPlan; planFileName=optarg; --- 186,195 ---- case 'h': break; ! case 1001: action=ActionRegisterPlan; planFileName=optarg; appendXML(planFileName); break; ! case 1002: action=ActionUnregisterPlan; planFileName=optarg; *************** *** 104,107 **** --- 197,204 ---- break; case 1003: + planFileName=optarg; + appendXML(planFileName); + break; + case 1004: filter.defaultPlan=1; if ((action!=ActionRegisterPlan) && *************** *** 110,113 **** --- 207,246 ---- } break; + case 2001: + action=ActionRegisterBatch; + batchName=optarg; + break; + case 2002: + action=ActionUnregisterBatch; + batchName=optarg; + break; + case 2003: + action=ActionListBatch; + break; + case 2004: + batchName=optarg; + break; + case 3001: + action=ActionRegisterCompiler; + compilerName=optarg; + break; + case 3002: + action=ActionUnregisterCompiler; + compilerName=optarg; + break; + case 3003: + action=ActionListCompiler; + break; + case 4001: + action=ActionRegisterOptionset; + optionsetName=optarg; + break; + case 4002: + action=ActionUnregisterOptionset; + optionsetName=optarg; + break; + case 4003: + action=ActionListOptionset; + break; default: case '?': *************** *** 115,118 **** --- 248,252 ---- } } + switch(action) { case ActionRegisterPlan: *************** *** 123,127 **** } P = new CBM::Plan; ! parseExitValue=!(P->store(planFileName)); if (filter.defaultPlan) { --- 257,261 ---- } P = new CBM::Plan; ! storePlan(P, planFileName); if (filter.defaultPlan) { *************** *** 145,158 **** break; } ! P=new CBM::Plan; ! if (P->restore(planFileName)) { parseExitValue=!(cbmSystem->unlink(planFileName)); if (!parseExitValue) { if (cbmSystem->Config()->getDefaultPlan()!="") { ! std::string abs = cbmSystem->Config()->Path(CBM::System::CurrentWD); ! ! abs+="/"; ! abs+=planFileName; if (abs==cbmSystem->Config()->getDefaultPlan()) { --- 279,289 ---- break; } ! P=restorePlan(planFileName); ! if (P) { parseExitValue=!(cbmSystem->unlink(planFileName)); if (!parseExitValue) { if (cbmSystem->Config()->getDefaultPlan()!="") { ! std::string abs = cbmSystem->fileAbsoluteName(planFileName); if (abs==cbmSystem->Config()->getDefaultPlan()) { *************** *** 165,174 **** } } } else { ! std::cerr << "Plan file not detected." << std::endl; } delete(P); break; default: printf("?\n"); --- 296,548 ---- } } + delete(P); + } + + break; + case ActionRegisterBatch: + if (!getPlanFileName(planFileName)) + break; + P=restorePlan(planFileName); + if (P) { + CBM::PlanBatch *B = new CBM::PlanBatch(batchName); + P->addBatch(B); + parseExitValue=!(P->store(planFileName)); + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << "Batch " << batchName << " added in " << planFileName << std::endl; + } + delete(P); + } + + break; + case ActionUnregisterBatch: + if (!getPlanFileName(planFileName)) + break; + P=restorePlan(planFileName); + + if (P) { + parseExitValue=!(P->removeBatch(batchName)); + if (!parseExitValue) { + std::cout << "Batch " << batchName << " removed from " << planFileName << std::endl; + storePlan(P, planFileName); + } else { + std::cerr << "Cant't find such batch in plan " << planFileName << std::endl; + } + } + break; + case ActionListBatch: + if (!getPlanFileName(planFileName)) + break; + P=restorePlan(planFileName); + + if (P) { + CBM::PlanBatch *B; + n = P->batchNumber(); + + parseExitValue=0; + if (!n) { + std::cout << "No batch registered." << std::endl; + } else { + printf("%d batch(s) found :\n", n); + for (i=0; i<n; i++) { + B=P->getBatch(i); + std::cout << " * " << B->Id() << std::endl; + } + } + delete(P); + } + break; + + case ActionRegisterCompiler: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + CS = new CompilerSelector(cbmSystem); + C = CS->select(compilerName); + + if (C) { + if (B->add(C)) { + storePlan(P, planFileName); + if (!parseExitValue) { + std::cout << C->Name() << " added in batch " << batchName << std::endl; + } + } else { + std::cerr << compilerName << " has not been added (probably because it was already present in that plan)." << std::endl; + } + delete(C); } else { ! std::cerr << compilerName << " is not a supported compiler." << std::endl; ! } ! delete(CS); ! delete(P); ! break; ! ! case ActionUnregisterCompiler: ! if (!getPlanFileName(planFileName)) ! break; ! ! B=restoreBatch(&P, ! planFileName, ! batchName); ! ! if (!P) ! break; ! ! if (!B) { ! delete(P); ! break; ! } ! ! CS = new CompilerSelector(cbmSystem); ! C = CS->select(compilerName); ! ! if (C) { ! if (B->remove(C)) { ! storePlan(P, planFileName); ! if (!parseExitValue) { ! std::cout << C->Name() << " removed from batch " << batchName << std::endl; ! } ! } else { ! std::cerr << compilerName << " not found in that plan" << std::endl; ! } ! delete(C); ! } else { ! std::cerr << compilerName << " is not a supported compiler." << std::endl; ! } ! delete(CS); ! delete(P); ! break; ! ! case ActionListCompiler: ! if (!getPlanFileName(planFileName)) ! break; ! ! B=restoreBatch(&P, ! planFileName, ! batchName); ! ! if (!P) ! break; ! ! if (!B) { ! delete(P); ! break; ! } ! ! n = B->compilerNumber(); ! ! parseExitValue=0; ! if (!n) { ! std::cout << "No compiler registered." << std::endl; ! } else { ! printf("%d compiler(s) found :\n", n); ! for (i=0; i<n; i++) { ! C=B->getCompiler(i); ! std::cout << " * Binary : " << C->Binary() << " - Name : " ! << C->Name() << std::endl; ! } ! } ! delete(P); ! break; ! case ActionRegisterOptionset: ! if (!getPlanFileName(planFileName)) ! break; ! ! B=restoreBatch(&P, ! planFileName, ! batchName); ! ! if (!P) ! break; ! ! if (!B) { ! delete(P); ! break; ! } ! ! OS = new CompilerOptionSet(optionsetName); ! if (B->add(OS)) { ! storePlan(P, planFileName); ! if (!parseExitValue) { ! std::cout << OS->Id() << " added in batch " << batchName << std::endl; ! } ! } else { ! std::cerr << optionsetName << " has not been added." << std::endl; ! } ! delete(OS); ! delete(P); ! break; ! ! case ActionUnregisterOptionset: ! if (!getPlanFileName(planFileName)) ! break; ! ! B=restoreBatch(&P, ! planFileName, ! batchName); ! ! if (!P) ! break; ! ! if (!B) { ! delete(P); ! break; ! } ! ! OS = new CompilerOptionSet(optionsetName); ! if (B->remove(OS)) { ! storePlan(P, planFileName); ! if (!parseExitValue) { ! std::cout << OS->Id() << " removed from batch " << batchName << std::endl; ! } ! } else { ! std::cerr << optionsetName << " not found in batch." << std::endl; } + + delete(OS); delete(P); break; + case ActionListOptionset: + if (!getPlanFileName(planFileName)) + break; + + B=restoreBatch(&P, + planFileName, + batchName); + + if (!P) + break; + + if (!B) { + delete(P); + break; + } + + n=B->compilerOptionNumber(); + if (!n) { + std::cout << "No option set registered." << std::endl; + } else { + printf("%d option set(s) found :\n", n); + + for(i=0; i<n; i++) { + OS=B->getCompilerOptions(i); + std::cout << " * " << OS->Id() << std::endl; + } + } + break; + default: printf("?\n"); |
From: Frederic T. <xf...@us...> - 2007-05-28 18:08:07
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16310 Modified Files: Config.cpp Config.h Log Message: Path(...) improved. Store/restore methods moved. Some improvements to obsolete usage through CBM::System. Index: Config.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Config.h 1 May 2007 15:05:00 -0000 1.9 --- Config.h 28 May 2007 18:08:00 -0000 1.10 *************** *** 35,42 **** XMLNode *paths; ! /** Planned benchmarks' description. ! * \sa root */ ! XMLNode *plan; /** Boolean to check if configuration was changed. --- 35,43 ---- XMLNode *paths; ! /** Path to XML defaults. ! * ! * Holds nodes defining default values and parameters. */ ! XMLNode *defaults; /** Boolean to check if configuration was changed. *************** *** 89,96 **** Config(std::string _filename); ! /** Get XML plan node ! * Used by CBM::Plan to get status of planified benchmarks and contexts. ! * \return XML Node holding plan configuration and settings */ ! virtual XMLNode *planNode(void); /** Get package status. --- 90,97 ---- Config(std::string _filename); ! ! virtual void setDefaultPlan(std::string _filename); ! ! virtual std::string getDefaultPlan(void); /** Get package status. *************** *** 174,186 **** virtual std::string str(void); - /** Set a new Plan node. - * - * A plan holds all options to apply to selected compilers for a bunch of - * benchmarks. This method set these data. - * \param _plan New plan settings - * \sa CBM::Plan - */ - virtual void setPlan(XMLNode *_plan); - /** Detect changes. * --- 175,178 ---- Index: Config.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Config.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Config.cpp 15 Feb 2007 18:55:46 -0000 1.10 --- Config.cpp 28 May 2007 18:08:00 -0000 1.11 *************** *** 12,15 **** --- 12,16 ---- #include <UI/UI.h> + #include <unistd.h> #include <config.h> *************** *** 50,69 **** } ! paths=root->getNode("paths"); ! if (!paths) { ! paths=root->addNode("paths"); changes=1; } ! plan=root->getNode("plan"); ! if (!plan) { ! plan=root->addNode("plan"); changes=1; } } ! CBM::XMLNode *Config::planNode(void) { ! return(plan); } --- 51,105 ---- } ! defaults=root->getNode("defaults"); ! if (!defaults) { ! defaults=root->addNode("defaults"); changes=1; } ! paths=defaults->getNode("paths"); ! if (!paths) { ! paths=defaults->addNode("paths"); changes=1; } } ! ! void Config::setDefaultPlan(std::string _filename) { ! XMLNode *dp = defaults->getNode("default-plan"); ! XMLAttribute *A; ! std::string absfn; ! ! absfn=cbmSystem->fileAbsoluteName(_filename); ! ! if (!dp) { ! dp=defaults->addNode("default-plan"); ! } ! ! A=dp->getAttribute("file"); ! if (!A) { ! A=new CBM::XMLAttribute("file", ! absfn); ! dp->add(A); ! } else { ! A->setValue(absfn); ! } ! changes=1; ! } ! ! std::string Config::getDefaultPlan(void) ! { ! XMLNode *dp = defaults->getNode("default-plan"); ! XMLAttribute *A; ! std::string r; ! ! if (!dp) ! return(""); ! ! A=dp->getAttribute("file"); ! if (!A) ! return(""); ! else ! return(A->Value()); } *************** *** 203,206 **** --- 239,243 ---- std::string pid; + pid=id[(int)dir]; for(i=0;i<n;i++) { *************** *** 347,355 **** std::string Config::Path(CBM::System::Dir dir) { ! XMLNode *N = pathNode(dir); CBM::XMLAttribute *A; ! A=N->getAttribute("value"); ! return(A->Value()); } --- 384,402 ---- std::string Config::Path(CBM::System::Dir dir) { ! XMLNode *N; CBM::XMLAttribute *A; + std::string r; + char *tmp; ! if (dir==CBM::System::CurrentWD) { ! tmp=get_current_dir_name(); ! r=tmp; ! free(tmp); ! return(r); ! } else { ! N=pathNode(dir); ! A=N->getAttribute("value"); ! return(A->Value()); ! } } *************** *** 359,374 **** } - void Config::setPlan(CBM::XMLNode *_plan) - { - if (plan!=_plan) { - if (plan) - delete(plan); - plan=_plan; - } - - changes=1; - root->add(_plan); - } - int Config::Changes(void) { --- 406,409 ---- |
From: Frederic T. <xf...@us...> - 2007-05-28 18:06:30
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15925 Modified Files: System.cpp System.h Log Message: fileAbsoluteName(...); added. Plan related methods and elements removed. Index: System.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** System.cpp 16 May 2007 12:06:39 -0000 1.15 --- System.cpp 28 May 2007 18:06:26 -0000 1.16 *************** *** 9,13 **** #include <System/System.h> #include <System/System-Thread-Download.h> - #include <Plan/Plan.h> #include <Base/Config.h> #include <Base/md5.h> --- 9,12 ---- *************** *** 44,48 **** configurationFile=_filename; - plan=0; cbmSystem=this; --- 43,46 ---- *************** *** 72,80 **** } - CBM::Plan *System::Plan(void) - { - return(plan); - } - int System::CheckDirectory(Dir where) { --- 70,73 ---- *************** *** 180,185 **** packageList(); - plan=new CBM::Plan(); - plan->restore(configuration->planNode()); return(1); } --- 173,176 ---- *************** *** 600,603 **** --- 591,611 ---- } + std::string System::fileAbsoluteName(std::string fn) + { + std::string abs; + + if (fn.length()>1) { + if (fn[0]=='/') + return(fn); + else { + abs = Config()->Path(CBM::System::CurrentWD); + abs+="/"; + abs+=fn; + return(abs); + } + } else + return(fn); + } + double System::endTimer(void) { Index: System.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** System.h 16 May 2007 09:46:19 -0000 1.9 --- System.h 28 May 2007 18:06:26 -0000 1.10 *************** *** 10,26 **** #define H_CBMSYSTEM - #ifdef SWIG - /* !!! If in SWIG parser, we need to define CBM::Plan so that all methods get - * correctly wrapped. Hope there's a better solution... */ - %module CBM - %{ - #include <Plan/Plan.h> - %} - #define CBM_PLAN CBM::Plan - - #else - # define CBM_PLAN class Plan - #endif - #include <vector> --- 10,13 ---- *************** *** 43,47 **** protected: class Config *configuration; - CBM_PLAN *plan; std::string configurationFile; --- 30,33 ---- *************** *** 56,60 **** Patches, /*!< Directory holding patches */ OS, /*!< System specific material */ ! Download /*!< Downloads temporary directory */ }; --- 42,47 ---- Patches, /*!< Directory holding patches */ OS, /*!< System specific material */ ! Download, /*!< Downloads temporary directory */ ! CurrentWD /*!< Current working directory */ }; *************** *** 104,109 **** virtual std::string Version(void); - virtual CBM_PLAN *Plan(void); - /** Get used configuration. \return A configuration instance (CBM::Config) --- 91,94 ---- *************** *** 290,293 **** --- 275,280 ---- virtual int fileSize(std::string fn); + virtual std::string fileAbsoluteName(std::string fn); + /** Initialize current object's timer. * |
From: Frederic T. <xf...@us...> - 2007-05-28 17:50:26
|
Update of /cvsroot/compbench/CompBenchmarks++ In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10305 Modified Files: configure.in Makefile.am Log Message: compbenchmarks-plan/ directory added. Index: Makefile.am =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile.am 27 May 2007 16:05:58 -0000 1.21 --- Makefile.am 28 May 2007 17:50:23 -0000 1.22 *************** *** 8,12 **** ! SUBDIRS = libcompbenchmarks SupportedBenchmarks CBM-PI compbenchmarks-core doxygen_headers = howto_kb.h \ --- 8,12 ---- ! SUBDIRS = libcompbenchmarks SupportedBenchmarks CBM-PI compbenchmarks-core compbenchmarks-plan doxygen_headers = howto_kb.h \ Index: configure.in =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/configure.in,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** configure.in 27 May 2007 16:05:58 -0000 1.33 --- configure.in 28 May 2007 17:50:17 -0000 1.34 *************** *** 15,19 **** AC_CANONICAL_TARGET ! AM_INIT_AUTOMAKE(compbenchmarks, 0.5.0-BETA1) AM_CONFIG_HEADER(libcompbenchmarks/config.h) --- 15,19 ---- AC_CANONICAL_TARGET ! AM_INIT_AUTOMAKE(compbenchmarks, 0.5.0-BETA2) AM_CONFIG_HEADER(libcompbenchmarks/config.h) *************** *** 301,304 **** --- 301,305 ---- CBM-PI/Makefile compbenchmarks-core/Makefile + compbenchmarks-plan/Makefile Makefile) |