[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestMultiProcessHandler.cxx 1.19 1.20 cmCTestMultiProcessHandler.h 1.11 1.12 cmCTestTestHandler.cxx 1.117 1.118
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Sep 8 17:10:37 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv32234
Modified Files:
cmCTestMultiProcessHandler.cxx cmCTestMultiProcessHandler.h
cmCTestTestHandler.cxx
Log Message:
ENH: ctest now writes time cost data to a file after a test set is run, and uses these time costs to schedule the processes the next time ctest is run in that build tree.
Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -C 2 -d -r1.19 -r1.20
*** cmCTestMultiProcessHandler.cxx 8 Sep 2009 18:48:23 -0000 1.19
--- cmCTestMultiProcessHandler.cxx 8 Sep 2009 21:10:33 -0000 1.20
***************
*** 31,39 ****
void
cmCTestMultiProcessHandler::SetTests(TestMap& tests,
- TestCostMap& testCosts,
PropertiesMap& properties)
{
this->Tests = tests;
- this->TestCosts = testCosts;
this->Properties = properties;
this->Total = this->Tests.size();
--- 31,37 ----
***************
*** 45,48 ****
--- 43,48 ----
this->TestFinishMap[i->first] = false;
}
+ this->ReadCostData();
+ this->CreateTestCostList();
}
***************
*** 272,275 ****
--- 272,276 ----
this->RunningTests.erase(p);
this->WriteCheckpoint(test);
+ this->WriteCostData(test, p->GetTestResults().ExecutionTime);
this->RunningCount -= GetProcessorsUsed(test);
delete p;
***************
*** 279,282 ****
--- 280,333 ----
//---------------------------------------------------------
+ void cmCTestMultiProcessHandler::ReadCostData()
+ {
+ std::string fname = this->CTest->GetBinaryDir()
+ + "/Testing/Temporary/CTestCostData.txt";
+
+ if(cmSystemTools::FileExists(fname.c_str(), true)
+ && this->ParallelLevel > 1)
+ {
+ std::ifstream fin;
+ fin.open(fname.c_str());
+ std::string line;
+ while(std::getline(fin, line))
+ {
+ std::vector<cmsys::String> parts =
+ cmSystemTools::SplitString(line.c_str(), ' ');
+
+ int index = atoi(parts[0].c_str());
+ float cost = atof(parts[1].c_str());
+ if(this->Properties[index] && this->Properties[index]->Cost == 0)
+ {
+ this->Properties[index]->Cost = cost;
+ }
+ }
+ fin.close();
+ }
+ cmSystemTools::RemoveFile(fname.c_str());
+ }
+
+ //---------------------------------------------------------
+ void cmCTestMultiProcessHandler::CreateTestCostList()
+ {
+ for(TestMap::iterator i = this->Tests.begin();
+ i != this->Tests.end(); ++i)
+ {
+ this->TestCosts[this->Properties[i->first]->Cost].insert(i->first);
+ }
+ }
+
+ //---------------------------------------------------------
+ void cmCTestMultiProcessHandler::WriteCostData(int index, float cost)
+ {
+ std::string fname = this->CTest->GetBinaryDir()
+ + "/Testing/Temporary/CTestCostData.txt";
+ std::fstream fout;
+ fout.open(fname.c_str(), std::ios::app);
+ fout << index << " " << cost << "\n";
+ fout.close();
+ }
+
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::WriteCheckpoint(int index)
{
***************
*** 289,292 ****
--- 340,344 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::MarkFinished()
{
***************
*** 296,300 ****
}
! //---------------------------------------------------------------------
//For ShowOnly mode
void cmCTestMultiProcessHandler::PrintTestList()
--- 348,352 ----
}
! //---------------------------------------------------------
//For ShowOnly mode
void cmCTestMultiProcessHandler::PrintTestList()
***************
*** 331,335 ****
}
! //----------------------------------------------------------------
void cmCTestMultiProcessHandler::CheckResume()
{
--- 383,387 ----
}
! //---------------------------------------------------------
void cmCTestMultiProcessHandler::CheckResume()
{
Index: cmCTestMultiProcessHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C 2 -d -r1.11 -r1.12
*** cmCTestMultiProcessHandler.h 8 Sep 2009 17:39:13 -0000 1.11
--- cmCTestMultiProcessHandler.h 8 Sep 2009 21:10:34 -0000 1.12
***************
*** 38,43 ****
cmCTestMultiProcessHandler();
// Set the tests
! void SetTests(TestMap& tests, TestCostMap& testCosts,
! PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
void SetParallelLevel(size_t);
--- 38,42 ----
cmCTestMultiProcessHandler();
// Set the tests
! void SetTests(TestMap& tests, PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
void SetParallelLevel(size_t);
***************
*** 71,74 ****
--- 70,76 ----
// Mark the checkpoint for the given test
void WriteCheckpoint(int index);
+ void WriteCostData(int index, float cost);
+ void ReadCostData();
+ void CreateTestCostList();
// Removes the checkpoint file
void MarkFinished();
Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.117
retrieving revision 1.118
diff -C 2 -d -r1.117 -r1.118
*** cmCTestTestHandler.cxx 8 Sep 2009 17:39:13 -0000 1.117
--- cmCTestTestHandler.cxx 8 Sep 2009 21:10:35 -0000 1.118
***************
*** 1011,1015 ****
cmCTestMultiProcessHandler::TestMap tests;
- cmCTestMultiProcessHandler::TestCostMap testCosts;
cmCTestMultiProcessHandler::PropertiesMap properties;
--- 1011,1014 ----
***************
*** 1038,1044 ****
tests[it->Index] = depends;
properties[it->Index] = &*it;
- testCosts[p.Cost].insert(p.Index);
}
! parallel.SetTests(tests, testCosts, properties);
parallel.SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
--- 1037,1042 ----
tests[it->Index] = depends;
properties[it->Index] = &*it;
}
! parallel.SetTests(tests, properties);
parallel.SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
More information about the Cmake-commits
mailing list