summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2010-02-25 21:23:49 (GMT)
committerBrad King <brad.king@kitware.com>2010-02-26 16:02:05 (GMT)
commitb4d27dc041c9164d6f3ad39e192f4b7d116ca3b3 (patch)
tree68d044c519a253948acbb09809078163dd4df63d /Source/CTest/cmCTestRunTest.cxx
parent55f012989c1aadd9dac1036c2e27df1853243392 (diff)
downloadCMake-b4d27dc041c9164d6f3ad39e192f4b7d116ca3b3.zip
CMake-b4d27dc041c9164d6f3ad39e192f4b7d116ca3b3.tar.gz
CMake-b4d27dc041c9164d6f3ad39e192f4b7d116ca3b3.tar.bz2
Use historical average of test times to schedule tests.
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 3e9156c..fa9794a 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -334,6 +334,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->TestResult.CompletionStatus = "Completed";
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
this->MemCheckPostProcess();
+ this->ComputeWeightedCost();
}
// Always push the current TestResult onto the
// TestHandler vector
@@ -342,7 +343,21 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
return passed;
}
-//--------------------------------------------------------------
+//----------------------------------------------------------------------
+void cmCTestRunTest::ComputeWeightedCost()
+{
+ int prev = this->TestProperties->PreviousRuns;
+ float avgcost = this->TestProperties->Cost;
+ double current = this->TestResult.ExecutionTime;
+
+ if(this->TestResult.Status == cmCTestTestHandler::COMPLETED)
+ {
+ this->TestProperties->Cost = ((prev * avgcost) + current) / (prev + 1);
+ this->TestProperties->PreviousRuns++;
+ }
+}
+
+//----------------------------------------------------------------------
void cmCTestRunTest::MemCheckPostProcess()
{
if(!this->TestHandler->MemCheck)
@@ -430,6 +445,7 @@ bool cmCTestRunTest::StartTest(size_t total)
&this->TestProperties->Environment);
}
+//----------------------------------------------------------------------
void cmCTestRunTest::ComputeArguments()
{
std::vector<std::string>::const_iterator j =