ENH: enhancements for cdash, include system information and better time entries

This commit is contained in:
Bill Hoffman 2008-01-30 11:17:36 -05:00
parent 45d0dd1344
commit c4093afc52
11 changed files with 105 additions and 16 deletions

View File

@ -399,6 +399,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Remember start build time
this->StartBuild = this->CTest->CurrentTime();
this->StartBuildTime = cmSystemTools::GetTime();
int retVal = 0;
int res = cmsysProcess_State_Exited;
if ( !this->CTest->GetShowOnly() )
@ -414,6 +415,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Remember end build time and calculate elapsed time
this->EndBuild = this->CTest->CurrentTime();
this->EndBuildTime = cmSystemTools::GetTime();
double elapsed_build_time = cmSystemTools::GetTime() - elapsed_time_start;
if (res != cmsysProcess_State_Exited || retVal )
{
@ -483,6 +485,9 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
this->CTest->StartXML(os);
os << "<Build>\n"
<< "\t<StartDateTime>" << this->StartBuild << "</StartDateTime>\n"
<< "\t<StartBuildTime>" <<
static_cast<unsigned int>(this->StartBuildTime)
<< "</StartBuildTime>\n"
<< "<BuildCommand>"
<< this->CTest->MakeXMLSafe(
this->CTest->GetCTestConfiguration("MakeCommand"))
@ -586,6 +591,8 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
}
os << "\t<Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n\t</Log>\n"
<< "\t<EndDateTime>" << this->EndBuild << "</EndDateTime>\n"
<< "\t<EndBuildTime>" << static_cast<unsigned int>(this->EndBuildTime)
<< "</EndBuildTime>\n"
<< "<ElapsedMinutes>" << static_cast<int>(elapsed_build_time/6)/10.0
<< "</ElapsedMinutes>"
<< "</Build>" << std::endl;

View File

@ -91,6 +91,8 @@ private:
std::string StartBuild;
std::string EndBuild;
double StartBuildTime;
double EndBuildTime;
std::vector<cmStdString> CustomErrorMatches;
std::vector<cmStdString> CustomErrorExceptions;

View File

@ -74,6 +74,8 @@ int cmCTestConfigureHandler::ProcessHandler()
return 1;
}
std::string start_time = this->CTest->CurrentTime();
unsigned int start_time_time = static_cast<unsigned int>(
cmSystemTools::GetTime());
cmGeneratedFileStream ofs;
this->StartLogFile("Configure", ofs);
@ -93,7 +95,10 @@ int cmCTestConfigureHandler::ProcessHandler()
this->CTest->StartXML(os);
os << "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>"
<< std::endl;
<< std::endl
<< "\t<StartConfigureTime>" << start_time_time
<< "</StartConfigureTime>\n";
if ( res == cmsysProcess_State_Exited && retVal )
{
os << retVal;
@ -105,6 +110,9 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string end_time = this->CTest->CurrentTime();
os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "\t<EndConfigureTime>" <<
static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</EndConfigureTime>\n"
<< "<ElapsedMinutes>"
<< static_cast<int>(
(cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0

View File

@ -171,7 +171,10 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
std::string local_start_time = this->CTest->CurrentTime();
this->CTest->StartXML(covLogFile);
covLogFile << "<CoverageLog>" << std::endl
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>"
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>"
<< "\t<StartTime>"
<< static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</StartTime>"
<< std::endl;
return true;
}
@ -182,6 +185,9 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
{
std::string local_end_time = this->CTest->CurrentTime();
ostr << "\t<EndDateTime>" << local_end_time << "</EndDateTime>" << std::endl
<< "\t<EndTime>" <<
static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</EndTime>" << std::endl
<< "</CoverageLog>" << std::endl;
this->CTest->EndXML(ostr);
char covLogFilename[1024];
@ -304,7 +310,8 @@ int cmCTestCoverageHandler::ProcessHandler()
}
std::string coverage_start_time = this->CTest->CurrentTime();
unsigned int coverage_start_time_time = static_cast<unsigned int>(
cmSystemTools::GetTime());
std::string sourceDir
= this->CTest->GetCTestConfiguration("SourceDirectory");
std::string binaryDir
@ -386,6 +393,8 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumFile << "<Coverage>" << std::endl
<< "\t<StartDateTime>" << coverage_start_time << "</StartDateTime>"
<< std::endl
<< "\t<StartTime>" << coverage_start_time_time << "</StartTime>"
<< std::endl;
int logFileCount = 0;
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
@ -577,7 +586,10 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumFile.setf(std::ios::fixed, std::ios::floatfield);
covSumFile.precision(2);
covSumFile << (percent_coverage)<< "</PercentCoverage>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n";
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "\t<EndTime>" <<
static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</EndTime>\n";
covSumFile << "<ElapsedMinutes>" <<
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>"
@ -1410,6 +1422,10 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
covSumFile << "<Coverage>" << std::endl
<< "\t<StartDateTime>"
<< coverage_start_time << "</StartDateTime>"
<< std::endl
<< "\t<StartTime>"
<< static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</StartTime>"
<< std::endl;
std::string stdline;
std::string errline;
@ -1561,9 +1577,13 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
<< "\t<PercentCoverage>";
covSumFile.setf(std::ios::fixed, std::ios::floatfield);
covSumFile.precision(2);
covSumFile << SAFEDIV(percent_coverage,number_files)<< "</PercentCoverage>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n";
covSumFile << "<ElapsedMinutes>" <<
covSumFile
<< SAFEDIV(percent_coverage,number_files)<< "</PercentCoverage>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "\t<EndTime>" << static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</EndTime>\n";
covSumFile
<< "<ElapsedMinutes>" <<
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>"
<< "</Coverage>" << std::endl;

View File

@ -306,7 +306,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
os << "\">" << std::endl;
os << "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
<< "\t<TestList>\n";
<< "\t<StartTestTime>" << this->StartTestTime << "</StartTestTime>\n"
<< "\t<TestList>\n";
cmCTestMemCheckHandler::TestResultsVector::size_type cc;
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
{
@ -405,6 +406,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
os << "\t</DefectList>" << std::endl;
os << "\t<EndDateTime>" << this->EndTest << "</EndDateTime>" << std::endl;
os << "\t<EndTestTime>" << this->EndTestTime
<< "</EndTestTime>" << std::endl;
os << "<ElapsedMinutes>"
<< static_cast<int>(this->ElapsedTestingTime/6)/10.0
<< "</ElapsedMinutes>\n";

View File

@ -917,6 +917,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size();
this->StartTest = this->CTest->CurrentTime();
this->StartTestTime = cmSystemTools::GetTime();
double elapsed_time_start = cmSystemTools::GetTime();
*this->LogFile << "Start testing: " << this->StartTest << std::endl
@ -999,6 +1000,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
}
this->EndTest = this->CTest->CurrentTime();
this->EndTestTime = cmSystemTools::GetTime();
this->ElapsedTestingTime = cmSystemTools::GetTime() - elapsed_time_start;
if ( this->LogFile )
{
@ -1023,6 +1025,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
this->CTest->StartXML(os);
os << "<Testing>\n"
<< "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
<< "\t<StartTestTime>" << this->StartTestTime << "</StartTestTime>\n"
<< "\t<TestList>\n";
cmCTestTestHandler::TestResultsVector::size_type cc;
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
@ -1110,6 +1113,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
}
os << "\t<EndDateTime>" << this->EndTest << "</EndDateTime>\n"
<< "\t<EndTestTime>" << this->EndTestTime << "</EndTestTime>\n"
<< "<ElapsedMinutes>"
<< static_cast<int>(this->ElapsedTestingTime/6)/10.0
<< "</ElapsedMinutes>"

View File

@ -136,6 +136,8 @@ protected:
std::vector<cmStdString> CustomTestsIgnore;
std::string StartTest;
std::string EndTest;
unsigned int StartTestTime;
unsigned int EndTestTime;
bool MemCheck;
int CustomMaximumPassedTestOutputSize;
int CustomMaximumFailedTestOutputSize;

View File

@ -541,6 +541,7 @@ int cmCTestUpdateHandler::ProcessHandler()
return -1;
}
std::string start_time = this->CTest->CurrentTime();
unsigned int start_time_time = cmSystemTools::GetTime();
double elapsed_time_start = cmSystemTools::GetTime();
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: "
@ -606,6 +607,7 @@ int cmCTestUpdateHandler::ProcessHandler()
<< "\t<BuildStamp>" << this->CTest->GetCurrentTag() << "-"
<< this->CTest->GetTestModelString() << "</BuildStamp>" << std::endl;
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<StartTime>" << start_time_time << "</StartTime>\n"
<< "\t<UpdateCommand>" << this->CTest->MakeXMLSafe(command)
<< "</UpdateCommand>\n"
<< "\t<UpdateType>" << this->CTest->MakeXMLSafe(
@ -1076,6 +1078,8 @@ int cmCTestUpdateHandler::ProcessHandler()
cmCTestLog(this->CTest, DEBUG, "End" << std::endl);
std::string end_time = this->CTest->CurrentTime();
os << "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "\t<EndTime>" << static_cast<unsigned int>(cmSystemTools::GetTime())
<< "</EndTime>\n"
<< "<ElapsedMinutes>" <<
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>\n"

View File

@ -22,6 +22,7 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include <cmsys/Directory.hxx>
#include <cmsys/SystemInformation.hxx>
#include "cmDynamicLoader.h"
#include "cmGeneratedFileStream.h"
#include "cmCTestCommand.h"
@ -1229,13 +1230,38 @@ void cmCTest::StartXML(std::ostream& ostr)
" NightlStartTime was not set correctly." << std::endl);
cmSystemTools::SetFatalErrorOccured();
}
// find out about the system
cmsys::SystemInformation info;
info.RunCPUCheck();
info.RunOSCheck();
info.RunMemoryCheck();
ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName")
<< "\" BuildStamp=\"" << this->CurrentTag << "-"
<< this->GetTestModelString() << "\" Name=\""
<< this->GetCTestConfiguration("Site") << "\" Generator=\"ctest"
<< cmVersion::GetCMakeVersion()
<< "\">" << std::endl;
<< "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName")
<< "\"\n\tBuildStamp=\"" << this->CurrentTag << "-"
<< this->GetTestModelString() << "\"\n\tName=\""
<< this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest"
<< cmVersion::GetCMakeVersion() << "\""
<< "\tOSName=\"" << info.GetOSName() << "\"\n"
<< "\tHostname=\"" << info.GetHostname() << "\"\n"
<< "\tOSRelease=\"" << info.GetOSRelease() << "\"\n"
<< "\tOSVersion=\"" << info.GetOSVersion() << "\"\n"
<< "\tOSPlatform=\"" << info.GetOSPlatform() << "\"\n"
<< "\tIs64Bits=\"" << info.Is64Bits() << "\"\n"
<< "\tVendorString=\"" << info.GetVendorString() << "\"\n"
<< "\tVendorID=\"" << info.GetVendorID() << "\"\n"
<< "\tFamilyID=\"" << info.GetFamilyID() << "\"\n"
<< "\tModelID=\"" << info.GetModelID() << "\"\n"
<< "\tProcessorCacheSize=\"" << info.GetProcessorCacheSize() << "\"\n"
<< "\tNumberOfLogicalCPU=\"" << info.GetNumberOfLogicalCPU() << "\"\n"
<< "\tNumberOfPhysicalCPU=\""<< info.GetNumberOfPhysicalCPU() << "\"\n"
<< "\tTotalVirtualMemory=\"" << info.GetTotalVirtualMemory() << "\"\n"
<< "\tTotalPhysicalMemory=\""<< info.GetTotalPhysicalMemory() << "\"\n"
<< "\tLogicalProcessorsPerPhysical=\""
<< info.GetLogicalProcessorsPerPhysical() << "\"\n"
<< "\tProcessorClockFrequency=\""
<< info.GetProcessorClockFrequency() << "\"\n"
<< ">" << std::endl;
ostr << "<SystemInformation junk=1.0></SystemInformation>\n";
}
//----------------------------------------------------------------------
@ -1266,6 +1292,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
cmCTestLog(this, OUTPUT, "\tAdd file: " << it->c_str() << std::endl);
std::string note_time = this->CurrentTime();
os << "<Note Name=\"" << this->MakeXMLSafe(it->c_str()) << "\">\n"
<< "<Time>" << cmSystemTools::GetTime() << "</Time>\n"
<< "<DateTime>" << note_time << "</DateTime>\n"
<< "<Text>" << std::endl;
std::ifstream ifs(it->c_str());

View File

@ -137,9 +137,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_USE_IOStream 1)
SET(KWSYS_USE_DateStamp 1)
SET(KWSYS_USE_String 1)
# SET(KWSYS_USE_SystemInformation 1)
SET(KWSYS_USE_SystemInformation 1)
ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Setup the large file support default.
IF(KWSYS_LFS_DISABLE)
SET(KWSYS_LFS_REQUESTED 0)

View File

@ -107,6 +107,11 @@
//# error "No Long long"
#endif
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
#endif
#include <@KWSYS_NAMESPACE@/stl/string>
#include <@KWSYS_NAMESPACE@/stl/vector>
@ -294,4 +299,11 @@ protected:
std::string OSPlatform;
};
} // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
# undef kwsys_ios
#endif
#endif