diff options
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 17 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 19 | ||||
-rw-r--r-- | Source/CTest/cmProcess.h | 7 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 7 |
6 files changed, 13 insertions, 52 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 39b90d8..2a9fd72 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -11,7 +11,6 @@ #include "cmParseGTMCoverage.h" #include "cmParseJacocoCoverage.h" #include "cmParsePHPCoverage.h" -#include "cmProcess.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" #include "cmXMLWriter.h" @@ -81,7 +80,7 @@ public: cmsysProcess_SetOption(this->Process, cmsysProcess_Option_HideWindow, 1); if (this->TimeOut >= std::chrono::duration<double>::zero()) { - cmsysProcess_SetTimeout(this->Process, this->TimeOut); + cmsysProcess_SetTimeout(this->Process, this->TimeOut.count()); } cmsysProcess_Execute(this->Process); this->PipeState = cmsysProcess_GetState(this->Process); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index a075649..c76eb4e 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -265,11 +265,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; char buf[1024]; - sprintf(buf, "%6.2f sec", - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestProcess->GetTotalTime()) - .count()) / - 1000.0); + sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count()); cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n"); if (outputTestErrorsToConsole) { @@ -394,11 +390,7 @@ void cmCTestRunTest::ComputeWeightedCost() { double prev = static_cast<double>(this->TestProperties->PreviousRuns); double avgcost = static_cast<double>(this->TestProperties->Cost); - double current = - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestResult.ExecutionTime) - .count()) / - 1000.0; + double current = this->TestResult.ExecutionTime.count(); if (this->TestResult.Status == cmCTestTestHandler::COMPLETED) { this->TestProperties->Cost = diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1e15cc5..e5a0503 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -540,10 +540,8 @@ int cmCTestTestHandler::ProcessHandler() this->PrintLabelOrSubprojectSummary(false); } char realBuf[1024]; - auto durationInMs = std::chrono::duration_cast<std::chrono::milliseconds>( - clock_finish - clock_start) - .count(); - sprintf(realBuf, "%6.2f sec", static_cast<double>(durationInMs) / 1000.0); + std::chrono::duration<double> durationInSecs = clock_finish - clock_start; + sprintf(realBuf, "%6.2f sec", durationInSecs.count()); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet); @@ -654,10 +652,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) // only use labels found in labels if (labels.find(l) != labels.end()) { labelTimes[l] += - double(std::chrono::duration_cast<std::chrono::milliseconds>( - result.ExecutionTime) - .count()) / - 1000.0 * result.Properties->Processors; + result.ExecutionTime.count() * result.Properties->Processors; ++labelCounts[l]; } } @@ -1327,11 +1322,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.StartElement("NamedMeasurement"); xml.Attribute("type", "numeric/double"); xml.Attribute("name", "Execution Time"); - xml.Element("Value", - double(std::chrono::duration_cast<std::chrono::milliseconds>( - result.ExecutionTime) - .count()) / - 1000.0); + xml.Element("Value", result.ExecutionTime.count()); xml.EndElement(); // NamedMeasurement if (!result.Reason.empty()) { const char* reasonType = "Pass Reason"; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 69ffb33..0db66c3 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -5,16 +5,6 @@ #include "cmProcessOutput.h" #include <iostream> -void cmsysProcess_SetTimeout(cmsysProcess* process, - std::chrono::duration<double> timeout) -{ - cmsysProcess_SetTimeout( - process, - double( - std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) / - 1000.0); -}; - cmProcess::cmProcess() { this->Process = nullptr; @@ -59,7 +49,7 @@ bool cmProcess::StartProcess() cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); } - cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetTimeout(this->Process, this->Timeout.count()); cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) == @@ -115,10 +105,7 @@ int cmProcess::GetNextOutputLine(std::string& line, { cmProcessOutput processOutput(cmProcessOutput::UTF8); std::string strdata; - double waitTimeout = - double( - std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) / - 1000.0; + double waitTimeout = timeout.count(); for (;;) { // Look for lines already buffered. if (this->Output.GetLine(line)) { @@ -240,7 +227,7 @@ int cmProcess::ReportStatus() void cmProcess::ChangeTimeout(std::chrono::duration<double> t) { this->Timeout = t; - cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetTimeout(this->Process, this->Timeout.count()); } void cmProcess::ResetStartTime() diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index cbb611d..f3b0bd7 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -10,13 +10,6 @@ #include <string> #include <vector> -/* - * A wrapper function for cmsysProcess_SetTimeout that takes an - * std::chrono::duration. For convenience only. - */ -void cmsysProcess_SetTimeout(cmsysProcess* process, - std::chrono::duration<double> timeout); - /** \class cmProcess * \brief run a process with c++ * diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index ed45644..902f1ae 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -50,7 +50,6 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmProcess.h" #include "cmProcessOutput.h" #include "cmState.h" #include "cmStateSnapshot.h" @@ -998,7 +997,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, cmsysProcess_SetCommand(cp, &*argv.begin()); cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); // Initialize tick's @@ -1186,7 +1185,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); char* data; @@ -2610,7 +2609,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, if (cmSystemTools::GetRunCommandHideConsole()) { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); std::vector<char> tempOutput; |