Thread: [Compbench-devel] CompBenchmarks++ cloptions.cpp,1.11,1.12
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-10 20:31:50
|
Update of /cvsroot/compbench/CompBenchmarks++ In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27658 Modified Files: cloptions.cpp Log Message: Improvements and adapations for CBMPackage and new related API usage. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/cloptions.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cloptions.cpp 23 Nov 2006 16:40:49 -0000 1.11 --- cloptions.cpp 10 Jan 2007 20:31:44 -0000 1.12 *************** *** 1,4 **** #include <cloptions.h> ! #include <Benchmark/Benchmark-Selector.h> #include <Compiler/Compiler.h> #include <System/System.h> --- 1,6 ---- #include <cloptions.h> ! #include <Benchmark/Package.h> ! #include <Benchmark/Benchmark.h> ! // #include <Benchmark/Benchmark-Selector.h> #include <Compiler/Compiler.h> #include <System/System.h> *************** *** 16,19 **** --- 18,48 ---- int parseExitValue = -1; + void cbmOptionsDisplayBenchmarks(CBMPackage *P) + { + CBMBenchmark *B; + int i; + int n = P->benchmarkNumber(); + + for(i=0; i<n; i++) { + B=P->Benchmark(i); + B->display(); + } + } + + void cbmOptionsDisplayAllBenchmarks(void) + { + CBMPackage *P; + int i; + int n = cbmSystem->packageNumber(); + + printf("n=%d\n", n); + for(i=0; i<n; i++) { + P=cbmSystem->Package(i); + printf("%d => %x\n", i, P); + P->display(); + cbmOptionsDisplayBenchmarks(P); + } + } + void cbmOptionsHelp(void) { *************** *** 55,61 **** } CBMBenchmark *cbmOptionsExpectBenchmark(char *optarg) { - CBMBenchmarkSelector SB(cbmSystem); CBMBenchmark *B = 0; std::string bench; --- 84,94 ---- } + void cbmUnknownPackage(char *pack) + { + std::cerr << "Unknow package '" << pack << "'" << std::endl; + } + CBMBenchmark *cbmOptionsExpectBenchmark(char *optarg) { CBMBenchmark *B = 0; std::string bench; *************** *** 68,72 **** bench=optarg; ! B=SB.select((char*) bench.c_str()); if (!B) { cbmUnknownBenchmark((char*) bench.c_str()); --- 101,105 ---- bench=optarg; ! B=cbmSystem->Benchmark(bench); if (!B) { cbmUnknownBenchmark((char*) bench.c_str()); *************** *** 77,87 **** } int cbmOptionsParse(int argc, char *argv[]) { int c; int context; ! CBMBenchmark::Status status; ! CBMBenchmarkSelector SB(cbmSystem); CBMBenchmark *B = 0; --- 110,142 ---- } + + CBMPackage *cbmOptionsExpectPackage(char *optarg) + { + CBMPackage *P = 0; + std::string pack; + + if (!optarg) { + std::cerr << "package missing in argument line" << std::endl; + parseExitValue=1; + return(0); + } + + pack=optarg; + P=cbmSystem->Package(pack); + if (!P) { + cbmUnknownPackage((char*) pack.c_str()); + parseExitValue=1; + return(0); + } + return(P); + } + int cbmOptionsParse(int argc, char *argv[]) { int c; int context; ! CBMPackage::Status status; ! CBMPackage *P = 0; CBMBenchmark *B = 0; *************** *** 140,154 **** break; case 'i': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=B->Install(UO_force); break; case 'u': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=B->Uninstall(); break; case 'L': ! SB.displayList(); parseExitValue=0; break; --- 195,209 ---- break; case 'i': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=P->Install(UO_force); break; case 'u': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=P->Uninstall(); break; case 'L': ! cbmOptionsDisplayAllBenchmarks(); parseExitValue=0; break; *************** *** 183,191 **** break; case 'f': ! B=cbmOptionsExpectBenchmark(optarg); ! if (!B) break; if (optind<=argc) { ! B->Fetch(argv[optind-1], UO_force); } else { std::cerr << "tarball missing in argument line" << std::endl; --- 238,246 ---- break; case 'f': ! P=cbmOptionsExpectPackage(optarg); ! if (!P) break; if (optind<=argc) { ! P->Fetch(argv[optind-1], UO_force); } else { std::cerr << "tarball missing in argument line" << std::endl; *************** *** 195,202 **** break; case 'D': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) { ! if (B->downloadURL()!="") { ! parseExitValue=!B->Download(); } else { UI->Fatal("Package is not known to be hosted anymore on the Internet. Use --fetch option"); --- 250,257 ---- break; case 'D': ! P=cbmOptionsExpectPackage(optarg); ! if (P) { ! if (P->downloadURL()!="") { ! parseExitValue=!P->Download(); } else { UI->Fatal("Package is not known to be hosted anymore on the Internet. Use --fetch option"); *************** *** 205,236 **** break; case 'E': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=!B->Extract(UO_force); break; case 'p': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=!B->Patch(UO_force); break; case 'g': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=!B->PreConfigure(UO_force); break; case 't': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) { if (!UO_enableTestSuite) { UI->Fatal("Incompatible options : --test and --disable-testsuite"); } } ! if (B) ! parseExitValue=!B->Test(UO_force); break; case 'r': ! B=cbmOptionsExpectBenchmark(optarg); ! if (B) ! parseExitValue=!B->Release(); break; case 'B': --- 260,291 ---- break; case 'E': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=!P->Extract(UO_force); break; case 'p': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=!P->Patch(UO_force); break; case 'g': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=!P->PreConfigure(UO_force); break; case 't': ! P=cbmOptionsExpectPackage(optarg); ! if (P) { if (!UO_enableTestSuite) { UI->Fatal("Incompatible options : --test and --disable-testsuite"); } } ! if (P) ! parseExitValue=!P->Test(UO_force); break; case 'r': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=!P->Release(); break; case 'B': *************** *** 261,281 **** O=new CBMCompilerOptions(C, (char*) options.c_str()); ! ! if (B->getStatus()<CBMBenchmark::Preconfigured) { ! std::cerr << "Benchmark not properly installed" << std::endl; parseExitValue=1; break; } ! context=B->ContextMatches(C, O); ! status=B->getStatus(); ! if ((status>=CBMBenchmark::Configured) && (!context)) { ! B->Release(); } if (!context) { ! B->Configure(C, O); ! B->Make(UO_force); ! B->Test(UO_force); } B->Bench(); --- 316,336 ---- O=new CBMCompilerOptions(C, (char*) options.c_str()); ! P=B->Package(); ! if (P->getStatus()<CBMPackage::Preconfigured) { ! std::cerr << "Package not properly installed" << std::endl; parseExitValue=1; break; } ! context=P->ContextMatches(C, O); ! status=P->getStatus(); ! if ((status>=CBMPackage::Configured) && (!context)) { ! P->Release(); } if (!context) { ! P->Configure(C, O); ! P->Make(UO_force); ! P->Test(UO_force); } B->Bench(); |