summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-05-27 12:20:29 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-05-28 12:37:39 +0200
commitab0599fcbdf25508e0a068edaee7a29aac14af8f (patch)
tree48f926767ebdbdd7a022ecc72d21357bcc4c7063
parent9ea3dbd7a3f80a5813dceb11dea416dc7a01d039 (diff)
downloadjustbuild-ab0599fcbdf25508e0a068edaee7a29aac14af8f.tar.gz
profile: include also the end time of the build
... which might be quite ahead of the end time of the invocation if writing out of the action graph delays the end of the invocation.
-rw-r--r--share/man/just-profile.5.md3
-rw-r--r--src/buildtool/main/main.cpp3
-rw-r--r--src/buildtool/profile/profile.cpp4
-rw-r--r--src/buildtool/profile/profile.hpp1
4 files changed, 11 insertions, 0 deletions
diff --git a/share/man/just-profile.5.md b/share/man/just-profile.5.md
index d3167b89..27dded3e 100644
--- a/share/man/just-profile.5.md
+++ b/share/man/just-profile.5.md
@@ -94,6 +94,9 @@ The profile file contains the following information.
- For the key *`"build start time"`* the start time of the build phase (if
any) in seconds since the epoch.
+- For the key *`"build stop time"`* the stop time of the build phase (if
+ any) in seconds since the epoch.
+
- For the key *`"stop time"`* the stop time of the invocation in seconds
since the epoch.
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 3da6de93..c1b8bcdf 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -1255,6 +1255,9 @@ auto main(int argc, char* argv[]) -> int {
std::move(trees),
std::move(tree_overlays),
std::move(cache_artifacts));
+ if (profile != nullptr) {
+ profile->StopBuild();
+ }
dump_and_cleanup_thread.join();
if (build_result) {
WriteTargetCacheEntries(
diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp
index 1d8a7b46..455aaf04 100644
--- a/src/buildtool/profile/profile.cpp
+++ b/src/buildtool/profile/profile.cpp
@@ -182,3 +182,7 @@ void Profile::SetRemoteExecutionConfig(RemoteExecutionConfig const& config) {
void Profile::StartBuild() {
profile_["build start time"] = std::time(nullptr);
}
+
+void Profile::StopBuild() {
+ profile_["build stop time"] = std::time(nullptr);
+}
diff --git a/src/buildtool/profile/profile.hpp b/src/buildtool/profile/profile.hpp
index 099ce2cc..bb5163ac 100644
--- a/src/buildtool/profile/profile.hpp
+++ b/src/buildtool/profile/profile.hpp
@@ -47,6 +47,7 @@ class Profile {
std::string const& cwd);
void NoteAnalysisError(std::string const& error_message);
void StartBuild();
+ void StopBuild();
private:
struct ActionData {