From 0aab4ee769211fa90e51926ae4411da29c1c0776 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 19 Jul 2024 15:43:07 +0200 Subject: just-mr: Use statistics instance in fetch map ...instead of using the singleton. --- src/other_tools/ops_maps/archive_fetch_map.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/other_tools/ops_maps/archive_fetch_map.cpp') diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp index f04d43f4..17b33092 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.cpp +++ b/src/other_tools/ops_maps/archive_fetch_map.cpp @@ -19,8 +19,6 @@ #include "fmt/core.h" #include "src/buildtool/file_system/file_storage.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" -#include "src/other_tools/just_mr/progress_reporting/progress.hpp" -#include "src/other_tools/just_mr/progress_reporting/statistics.hpp" #include "src/other_tools/just_mr/utils.hpp" namespace { @@ -30,6 +28,7 @@ void ProcessContent(std::filesystem::path const& content_path, gsl::not_null const& local_api, IExecutionApi const* remote_api, std::string const& content, + gsl::not_null const& stats, ArchiveFetchMap::SetterPtr const& setter, ArchiveFetchMap::LoggerPtr const& logger) { // try to back up to remote CAS @@ -60,7 +59,7 @@ void ProcessContent(std::filesystem::path const& content_path, return; } // success - JustMRStatistics::Instance().IncrementExecutedCounter(); + stats->IncrementExecutedCounter(); (*setter)(true); } @@ -71,16 +70,18 @@ auto CreateArchiveFetchMap(gsl::not_null const& content_cas_map, gsl::not_null const& storage, gsl::not_null const& local_api, IExecutionApi const* remote_api, + gsl::not_null const& stats, std::size_t jobs) -> ArchiveFetchMap { auto fetch_archive = [content_cas_map, fetch_dir, storage, local_api, - remote_api](auto ts, - auto setter, - auto logger, - auto /* unused */, - auto const& key) { + remote_api, + stats](auto ts, + auto setter, + auto logger, + auto /* unused */, + auto const& key) { // get corresponding distfile auto distfile = (key.distfile @@ -96,6 +97,7 @@ auto CreateArchiveFetchMap(gsl::not_null const& content_cas_map, local_api, remote_api, content = key.content, + stats, setter, logger]([[maybe_unused]] auto const& values) { // content is in local CAS now @@ -109,6 +111,7 @@ auto CreateArchiveFetchMap(gsl::not_null const& content_cas_map, local_api, remote_api, content, + stats, setter, logger); }, -- cgit v1.2.3