Explorar o código

ENH: add start end time for procs

Bill Hoffman %!s(int64=17) %!d(string=hai) anos
pai
achega
ede2be4be1
Modificáronse 2 ficheiros con 6 adicións e 0 borrados
  1. 4 0
      Source/CTest/cmProcess.cxx
  2. 2 0
      Source/CTest/cmProcess.h

+ 4 - 0
Source/CTest/cmProcess.cxx

@@ -16,6 +16,7 @@
 =========================================================================*/
 
 #include <cmProcess.h>
+#include <cmSystemTools.h>
 
 cmProcess::cmProcess()
 {
@@ -43,6 +44,7 @@ bool cmProcess::StartProcess()
     {
     return false;
     }
+  this->StartTime = cmSystemTools::GetTime();
   this->ProcessArgs.clear();
   // put the command as arg0
   this->ProcessArgs.push_back(this->Command.c_str());
@@ -210,6 +212,8 @@ bool cmProcess::IsRunning()
   // if the process is done, then wait for it to exit
   cmsysProcess_WaitForExit(this->Process, 0);
   this->ExitValue = cmsysProcess_GetExitValue(this->Process);
+  this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
+//  std::cerr << "Time to run: " << this->TotalTime << "\n";
   return false;
 }
 

+ 2 - 0
Source/CTest/cmProcess.h

@@ -56,6 +56,8 @@ public:
 private:
   int LastOutputPipe;
   double Timeout;
+  double StartTime;
+  double TotalTime;
   cmsysProcess* Process;
   std::vector<char> StdErrorBuffer;
   std::vector<char> StdOutBuffer;