summaryrefslogtreecommitdiff
path: root/src/buildtool/profile/profile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/profile/profile.cpp')
-rw-r--r--src/buildtool/profile/profile.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp
index 543cd681..3ee7f2a6 100644
--- a/src/buildtool/profile/profile.cpp
+++ b/src/buildtool/profile/profile.cpp
@@ -20,6 +20,17 @@ void Profile::Write(int exit_code) {
if (not output_file_) {
return;
}
+
+ if (not actions_.empty()) {
+ auto actions = nlohmann::json::object();
+ for (auto const& [k, v] : actions_) {
+ auto entry = nlohmann::json::object();
+ entry["cached"] = v.cached;
+ actions[k] = entry;
+ }
+ profile_["actions"] = actions;
+ }
+
profile_["exit code"] = exit_code;
std::ofstream os(*output_file_);
@@ -33,3 +44,9 @@ void Profile::SetTarget(nlohmann::json target) {
void Profile::SetConfiguration(nlohmann::json configuration) {
profile_["configuration"] = std::move(configuration);
}
+
+void Profile::NoteActionCompleted(std::string const& id,
+ IExecutionResponse::Ptr const& response) {
+ std::unique_lock lock{mutex_};
+ actions_[id] = ActionData{.cached = response->IsCached()};
+}