Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9703
Modified Files:
Plan.cpp Plan.h
Log Message:
Host configuration and settings can be stored in results' output directory.
Index: Plan.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Plan.h 30 May 2007 17:04:03 -0000 1.8
--- Plan.h 20 Aug 2007 17:08:22 -0000 1.9
***************
*** 10,13 ****
--- 10,14 ----
#include <Base/XML.h>
+ #include <Base/Result.h>
#ifdef SWIG
***************
*** 47,50 ****
--- 48,54 ----
int iteration;
std::string filename;
+ std::string outputDirectory;
+ int hostCopied;
+ int planCopied;
virtual CBM_PB *batchForIteration(int *it_in_plan);
***************
*** 53,56 ****
--- 57,66 ----
Plan();
+ virtual int setOutputDirectory(std::string _outputDirectory);
+ virtual std::string getOutputDirectory(void);
+ virtual int outputDirectoryAdd(CBM::Result *_result);
+ virtual int outputDirectoryCopyHost(void);
+ virtual int outputDirectoryCopyPlan(void);
+
virtual CBM_PB *addBatch(CBM_PB *_ps);
virtual int removeBatch(CBM_PB *_ps);
Index: Plan.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Plan.cpp 2 Aug 2007 17:07:53 -0000 1.17
--- Plan.cpp 20 Aug 2007 17:08:22 -0000 1.18
***************
*** 27,30 ****
--- 27,108 ----
{
iteration=0;
+ outputDirectory="";
+ planCopied=0;
+ hostCopied=0;
+ }
+
+ int Plan::setOutputDirectory(std::string _outputDirectory)
+ {
+ int ok = 0;
+
+ outputDirectory=_outputDirectory;
+ if (!cbmSystem->checkDirectory(outputDirectory)) {
+ ok=cbmSystem->mkdir(outputDirectory);
+ }
+
+ return(ok);
+ }
+
+ std::string Plan::getOutputDirectory(void)
+ {
+ return(outputDirectory);
+ }
+
+ int Plan::outputDirectoryAdd(CBM::Result *_result)
+ {
+ int ok = 0;
+ std::string fn;
+ static int idx = 1;
+ std::string data;
+ char tmp[32];
+ int fExists = 1;
+ time_t tme;
+
+ while (fExists) {
+ sprintf(tmp, "%d", idx);
+ tme=time(NULL);
+ data=ctime(&tme);
+ fn=outputDirectory;
+ fn+="/";
+ fn+="r-";
+ fn+=cbmSystem->md5(data);
+ fn+=".xml";
+
+ idx++;
+ fExists=cbmSystem->fileExists(fn);
+ }
+
+ ok=cbmSystem->fileWrite(fn,
+ _result->resultNode()->str());
+ return(ok);
+ }
+
+ int Plan::outputDirectoryCopyHost(void)
+ {
+ std::string fn;
+
+ if (hostCopied)
+ return(1);
+
+ fn=outputDirectory;
+ fn+="/";
+ fn+="host.xml";
+
+ if (cbmSystem->fileExists(fn))
+ return(1);
+
+ return(cbmSystem->storeHost(fn));
+ }
+
+ int Plan::outputDirectoryCopyPlan(void)
+ {
+ std::string fn;
+
+ fn=outputDirectory;
+ fn+="/";
+ fn+="plan.xml";
+
+
+ return(cbmSystem->storeConfiguration(fn));
}
|