summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/content_git_map.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-17 11:40:57 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-20 11:10:05 +0100
commit7104c7f1dc04187bd23e9499f247d628592e0dd8 (patch)
treec719775c5f3fb5e1219c333979fda7ed994e8294 /src/other_tools/root_maps/content_git_map.cpp
parentfe99ba0bb02ca2032a464ae0eddc41e0e9ebdb2c (diff)
downloadjustbuild-7104c7f1dc04187bd23e9499f247d628592e0dd8.tar.gz
just-mr: rework progress reporting and statistics
To avoid unnecessary work, just-mr uses on-disk caches, including for the mapping of a distdir to the corresponding git tree. This, however, implies that the number of repositories that are actually considered varies: in order to fetch a distdir repository, all involved archives have to be fetched, but if we have a cache hit none of them is even looked at. So, in order to have a consistent reporting only count top-level targets (i.e., the reachable repositories) in the statistics, not the archives implicitly contained in a distdir, nor low-level sub tasks. The actual fetch acitvity is shown separately by the task tracker.
Diffstat (limited to 'src/other_tools/root_maps/content_git_map.cpp')
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index f36f3142..80072fee 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -114,12 +114,12 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot().string()}));
- // report cache hit
- JustMRStatistics::Instance().IncrementCacheHitsCounter();
+ (*setter)(std::pair(
+ nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ JustMR::Utils::GetGitCacheRoot().string()}),
+ true));
},
[logger, target_path = JustMR::Utils::GetGitCacheRoot()](
auto const& msg, bool fatal) {
@@ -132,9 +132,6 @@ auto CreateContentGitMap(
});
}
else {
- // start work reporting;
- JustMRProgress::Instance().TaskTracker().Start(key.archive.origin);
- JustMRStatistics::Instance().IncrementQueuedCounter();
// do the fetch and import_to_git
content_cas_map->ConsumeAfterKeysReady(
ts,
@@ -242,15 +239,13 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot().string()}));
- // report work done
- JustMRProgress::Instance().TaskTracker().Stop(
- origin);
- JustMRStatistics::Instance()
- .IncrementExecutedCounter();
+ (*setter)(
+ std::pair(nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ JustMR::Utils::GetGitCacheRoot()
+ .string()}),
+ false));
},
[logger, target_path = tmp_dir->GetPath()](
auto const& msg, bool fatal) {
@@ -271,6 +266,6 @@ auto CreateContentGitMap(
});
}
};
- return AsyncMapConsumer<ArchiveRepoInfo, nlohmann::json>(gitify_content,
- jobs);
+ return AsyncMapConsumer<ArchiveRepoInfo, std::pair<nlohmann::json, bool>>(
+ gitify_content, jobs);
}