diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-01-17 21:11:46 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-01-19 14:51:07 (GMT) |
commit | 5f0c5ec49b553cbe4482d9a8cf7e8889dc90e759 (patch) | |
tree | 042aab69ad69e49171eb7aef5431a3c87b66f9ff | |
parent | 43c4faaf48220df719b8e2428ee0fcb8886169d3 (diff) | |
download | CMake-5f0c5ec49b553cbe4482d9a8cf7e8889dc90e759.zip CMake-5f0c5ec49b553cbe4482d9a8cf7e8889dc90e759.tar.gz CMake-5f0c5ec49b553cbe4482d9a8cf7e8889dc90e759.tar.bz2 |
cmake: Print configure/generate time
10 files changed, 37 insertions, 20 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8ca6ee6..f000a28 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -4,11 +4,13 @@ #include <algorithm> #include <cassert> +#include <chrono> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <initializer_list> +#include <iomanip> #include <iterator> #include <sstream> #include <utility> @@ -1303,6 +1305,8 @@ void cmGlobalGenerator::CreateLocalGenerators() void cmGlobalGenerator::Configure() { + auto startTime = std::chrono::steady_clock::now(); + this->FirstTimeProgress = 0.0f; this->ClearGeneratorMembers(); this->NextDeferId = 0; @@ -1350,6 +1354,8 @@ void cmGlobalGenerator::Configure() "number of local generators", cmStateEnums::INTERNAL); + auto endTime = std::chrono::steady_clock::now(); + if (this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE) { std::ostringstream msg; if (cmSystemTools::GetErrorOccurredFlag()) { @@ -1363,7 +1369,10 @@ void cmGlobalGenerator::Configure() } } } else { - msg << "Configuring done"; + auto ms = std::chrono::duration_cast<std::chrono::milliseconds>( + endTime - startTime); + msg << "Configuring done (" << std::fixed << std::setprecision(1) + << ms.count() / 1000.0L << "s)"; } this->CMakeInstance->UpdateProgress(msg.str(), -1); } @@ -1606,6 +1615,8 @@ bool cmGlobalGenerator::Compute() void cmGlobalGenerator::Generate() { + auto startTime = std::chrono::steady_clock::now(); + // Create a map from local generator to the complete set of targets // it builds by default. this->InitializeProgressMarks(); @@ -1688,7 +1699,13 @@ void cmGlobalGenerator::Generate() w.str()); } - this->CMakeInstance->UpdateProgress("Generating done", -1); + auto endTime = std::chrono::steady_clock::now(); + auto ms = + std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime); + std::ostringstream msg; + msg << "Generating done (" << std::fixed << std::setprecision(1) + << ms.count() / 1000.0L << "s)"; + this->CMakeInstance->UpdateProgress(msg.str(), -1); } bool cmGlobalGenerator::ComputeTargetDepends() diff --git a/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt index c23ab89..f32056a 100644 --- a/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt +++ b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt @@ -1,2 +1,2 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/Configure/CopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt index 6a856a4..2176554 100644 --- a/Tests/RunCMake/Configure/CopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done.* --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt index 8877451..8c1c301 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt @@ -1,4 +1,4 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: [^ ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt index 8877451..8c1c301 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt @@ -1,4 +1,4 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: [^ ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt b/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt index 34c873c..9f4f24e 100644 --- a/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt +++ b/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build diff --git a/Tests/RunCMake/configure_file/RerunCMake-stdout.txt b/Tests/RunCMake/configure_file/RerunCMake-stdout.txt index 34c873c..9f4f24e 100644 --- a/Tests/RunCMake/configure_file/RerunCMake-stdout.txt +++ b/Tests/RunCMake/configure_file/RerunCMake-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt index b0438f5..a5ca781 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt @@ -1,5 +1,5 @@ Running CMake on RerunCMake FALSE --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt index 9c78b26..e37d210 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RerunCMake-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-stdout.txt index 9c78b26..e37d210 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build |