summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 04c1e273..d3167b89 100644
--- a/share/man/just-profile.5.md
+++ b/share/man/just-profile.5.md
@@ -91,6 +91,9 @@ The profile file contains the following information.
- For the key *`"start time"`* the start time of the invocation in
seconds since the epoch.
+- For the key *`"build start time"`* the start 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 10abfa1a..3da6de93 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -1244,6 +1244,9 @@ auto main(int argc, char* argv[]) -> int {
analyse_result->id.ToShortString(
Evaluator::GetExpressionLogLimit()));
+ if (profile != nullptr) {
+ profile->StartBuild();
+ }
auto build_result =
traverser.BuildAndStage(artifacts,
runfiles,
diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp
index 5ee9cd15..1d8a7b46 100644
--- a/src/buildtool/profile/profile.cpp
+++ b/src/buildtool/profile/profile.cpp
@@ -178,3 +178,7 @@ void Profile::SetRemoteExecutionConfig(RemoteExecutionConfig const& config) {
remote["dispatch"] = dispatch;
profile_["remote"] = remote;
}
+
+void Profile::StartBuild() {
+ profile_["build start time"] = std::time(nullptr);
+}
diff --git a/src/buildtool/profile/profile.hpp b/src/buildtool/profile/profile.hpp
index 0db655fb..099ce2cc 100644
--- a/src/buildtool/profile/profile.hpp
+++ b/src/buildtool/profile/profile.hpp
@@ -46,6 +46,7 @@ class Profile {
IExecutionResponse::Ptr const& response,
std::string const& cwd);
void NoteAnalysisError(std::string const& error_message);
+ void StartBuild();
private:
struct ActionData {