diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-17 15:34:05 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-17 17:19:55 +0100 |
commit | c3fdcb7d3b072f6fd62a7b64a18fb55f2e7bcdde (patch) | |
tree | 842d4793894eae9dc130d645dc62860782c553be /src | |
parent | b1ccb71a4bdbacd44843abfa9497576016962ed8 (diff) | |
download | justbuild-c3fdcb7d3b072f6fd62a7b64a18fb55f2e7bcdde.tar.gz |
just profile: include action stdout/stderr if any
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/profile/profile.cpp | 24 | ||||
-rw-r--r-- | src/buildtool/profile/profile.hpp | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp index 66ea50d6..6d1cc34d 100644 --- a/src/buildtool/profile/profile.cpp +++ b/src/buildtool/profile/profile.cpp @@ -34,6 +34,12 @@ void Profile::Write(int exit_code) { entry["duration"] = v.duration; } entry["artifacts"] = v.artifacts; + if (v.out) { + entry["stdout"] = *v.out; + } + if (v.err) { + entry["stderr"] = *v.err; + } actions[k] = entry; } profile_["actions"] = actions; @@ -57,16 +63,34 @@ void Profile::NoteActionCompleted(std::string const& id, IExecutionResponse::Ptr const& response) { std::unique_lock lock{mutex_}; auto artifacts = response->Artifacts(); + std::optional<std::string> out = std::nullopt; + std::optional<std::string> err = std::nullopt; + if (response->HasStdOut()) { + auto action_out = response->StdOutDigest(); + if (action_out) { + out = action_out->hash(); + } + } + if (response->HasStdErr()) { + auto action_err = response->StdErrDigest(); + if (action_err) { + err = action_err->hash(); + } + } if (not artifacts) { actions_[id] = ActionData{ .cached = response->IsCached(), .duration = response->ExecutionDuration(), + .out = out, + .err = err, .artifacts = std::unordered_map<std::string, std::string>()}; } else { actions_[id] = ActionData{ .cached = response->IsCached(), .duration = response->ExecutionDuration(), + .out = out, + .err = err, .artifacts = std::unordered_map<std::string, std::string>( (*artifacts)->size())}; for (auto const& [k, v] : **artifacts) { diff --git a/src/buildtool/profile/profile.hpp b/src/buildtool/profile/profile.hpp index 7e03b0ae..71511245 100644 --- a/src/buildtool/profile/profile.hpp +++ b/src/buildtool/profile/profile.hpp @@ -42,6 +42,8 @@ class Profile { struct ActionData { bool cached; double duration; + std::optional<std::string> out; + std::optional<std::string> err; std::unordered_map<std::string, std::string> artifacts; }; |