From c4093afc52967c987f0cd2947949899642db977b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 30 Jan 2008 11:17:36 -0500 Subject: ENH: enhancements for cdash, include system information and better time entries --- Source/CTest/cmCTestBuildHandler.cxx | 7 ++++++ Source/CTest/cmCTestBuildHandler.h | 2 ++ Source/CTest/cmCTestConfigureHandler.cxx | 10 +++++++- Source/CTest/cmCTestCoverageHandler.cxx | 32 +++++++++++++++++++++----- Source/CTest/cmCTestMemCheckHandler.cxx | 5 +++- Source/CTest/cmCTestTestHandler.cxx | 4 ++++ Source/CTest/cmCTestTestHandler.h | 2 ++ Source/CTest/cmCTestUpdateHandler.cxx | 4 ++++ Source/cmCTest.cxx | 39 +++++++++++++++++++++++++++----- Source/kwsys/CMakeLists.txt | 4 ++-- Source/kwsys/SystemInformation.hxx.in | 12 ++++++++++ 11 files changed, 105 insertions(+), 16 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 31b9adf..bb1d7ee 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -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 << "\n" << "\t" << this->StartBuild << "\n" + << "\t" << + static_cast(this->StartBuildTime) + << "\n" << "" << this->CTest->MakeXMLSafe( this->CTest->GetCTestConfiguration("MakeCommand")) @@ -586,6 +591,8 @@ void cmCTestBuildHandler::GenerateDartBuildOutput( } os << "\t\n\t\n" << "\t" << this->EndBuild << "\n" + << "\t" << static_cast(this->EndBuildTime) + << "\n" << "" << static_cast(elapsed_build_time/6)/10.0 << "" << "" << std::endl; diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index e4f3f43..73d5a5a 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -91,6 +91,8 @@ private: std::string StartBuild; std::string EndBuild; + double StartBuildTime; + double EndBuildTime; std::vector CustomErrorMatches; std::vector CustomErrorExceptions; diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 1a67289..b81767b 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -74,6 +74,8 @@ int cmCTestConfigureHandler::ProcessHandler() return 1; } std::string start_time = this->CTest->CurrentTime(); + unsigned int start_time_time = static_cast( + cmSystemTools::GetTime()); cmGeneratedFileStream ofs; this->StartLogFile("Configure", ofs); @@ -93,7 +95,10 @@ int cmCTestConfigureHandler::ProcessHandler() this->CTest->StartXML(os); os << "\n" << "\t" << start_time << "" - << std::endl; + << std::endl + << "\t" << start_time_time + << "\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" << retVal << "\n" << "\t" << end_time << "\n" + << "\t" << + static_cast(cmSystemTools::GetTime()) + << "\n" << "" << static_cast( (cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index db1504c..5ef9e55 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -171,7 +171,10 @@ bool cmCTestCoverageHandler::StartCoverageLogFile( std::string local_start_time = this->CTest->CurrentTime(); this->CTest->StartXML(covLogFile); covLogFile << "" << std::endl - << "\t" << local_start_time << "" + << "\t" << local_start_time << "" + << "\t" + << static_cast(cmSystemTools::GetTime()) + << "" << std::endl; return true; } @@ -182,6 +185,9 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, { std::string local_end_time = this->CTest->CurrentTime(); ostr << "\t" << local_end_time << "" << std::endl + << "\t" << + static_cast(cmSystemTools::GetTime()) + << "" << std::endl << "" << 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( + cmSystemTools::GetTime()); std::string sourceDir = this->CTest->GetCTestConfiguration("SourceDirectory"); std::string binaryDir @@ -386,6 +393,8 @@ int cmCTestCoverageHandler::ProcessHandler() covSumFile << "" << std::endl << "\t" << coverage_start_time << "" + << std::endl + << "\t" << coverage_start_time_time << "" << 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)<< "\n" - << "\t" << end_time << "\n"; + << "\t" << end_time << "\n" + << "\t" << + static_cast(cmSystemTools::GetTime()) + << "\n"; covSumFile << "" << static_cast((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 << "" @@ -1410,6 +1422,10 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( covSumFile << "" << std::endl << "\t" << coverage_start_time << "" + << std::endl + << "\t" + << static_cast(cmSystemTools::GetTime()) + << "" << std::endl; std::string stdline; std::string errline; @@ -1561,9 +1577,13 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( << "\t"; covSumFile.setf(std::ios::fixed, std::ios::floatfield); covSumFile.precision(2); - covSumFile << SAFEDIV(percent_coverage,number_files)<< "\n" - << "\t" << end_time << "\n"; - covSumFile << "" << + covSumFile + << SAFEDIV(percent_coverage,number_files)<< "\n" + << "\t" << end_time << "\n" + << "\t" << static_cast(cmSystemTools::GetTime()) + << "\n"; + covSumFile + << "" << static_cast((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 << "" << "" << std::endl; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 252c5b2..71832b5 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -306,7 +306,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) os << "\">" << std::endl; os << "\t" << this->StartTest << "\n" - << "\t\n"; + << "\t" << this->StartTestTime << "\n" + << "\t\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" << std::endl; os << "\t" << this->EndTest << "" << std::endl; + os << "\t" << this->EndTestTime + << "" << std::endl; os << "" << static_cast(this->ElapsedTestingTime/6)/10.0 << "\n"; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b01535f..90e5265 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -917,6 +917,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &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 &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 << "\n" << "\t" << this->StartTest << "\n" + << "\t" << this->StartTestTime << "\n" << "\t\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" << this->EndTest << "\n" + << "\t" << this->EndTestTime << "\n" << "" << static_cast(this->ElapsedTestingTime/6)/10.0 << "" diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index a84e9fe..395ad3b 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -136,6 +136,8 @@ protected: std::vector CustomTestsIgnore; std::string StartTest; std::string EndTest; + unsigned int StartTestTime; + unsigned int EndTestTime; bool MemCheck; int CustomMaximumPassedTestOutputSize; int CustomMaximumFailedTestOutputSize; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index e47f967..a8afe12 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -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" << this->CTest->GetCurrentTag() << "-" << this->CTest->GetTestModelString() << "" << std::endl; os << "\t" << start_time << "\n" + << "\t" << start_time_time << "\n" << "\t" << this->CTest->MakeXMLSafe(command) << "\n" << "\t" << 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" << end_time << "\n" + << "\t" << static_cast(cmSystemTools::GetTime()) + << "\n" << "" << static_cast((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 << "\n" diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c6b71b6..b8d4034 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -22,6 +22,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include +#include #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 << "\n" - << "GetCTestConfiguration("BuildName") - << "\" BuildStamp=\"" << this->CurrentTag << "-" - << this->GetTestModelString() << "\" Name=\"" - << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest" - << cmVersion::GetCMakeVersion() - << "\">" << std::endl; + << "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 << "\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 << "MakeXMLSafe(it->c_str()) << "\">\n" + << "\n" << "" << note_time << "\n" << "" << std::endl; std::ifstream ifs(it->c_str()); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index a2a438c..b13d061 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -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) diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in index 4894cca..36eb547 100644 --- a/Source/kwsys/SystemInformation.hxx.in +++ b/Source/kwsys/SystemInformation.hxx.in @@ -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 -- cgit v0.12