From 87eb89d8d3b28d7e9da26199654ec3be8ee59565 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 11 Mar 2024 16:52:52 +0100 Subject: just serve: Improve progress reporting During analysis it is useful to track and report the progress for all export targets. This is not exclusively linked to a serve endpoint being present, despite most of the time being expected to be spent in export targets being served from the remote endpoint. This commit refactors the current implementation to give proper feedback to the user on the progress of the analysis phase. --- src/buildtool/build_engine/target_map/export.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/buildtool/build_engine/target_map/export.cpp') diff --git a/src/buildtool/build_engine/target_map/export.cpp b/src/buildtool/build_engine/target_map/export.cpp index 29085716..e035d2c0 100644 --- a/src/buildtool/build_engine/target_map/export.cpp +++ b/src/buildtool/build_engine/target_map/export.cpp @@ -99,10 +99,12 @@ void ExportRule( const gsl::not_null& repo_config, const ActiveTargetCache& target_cache, const gsl::not_null& stats, + const gsl::not_null& exports_progress, const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller, const BuildMaps::Target::TargetMap::SetterPtr& setter, const BuildMaps::Target::TargetMap::LoggerPtr& logger, const gsl::not_null result_map) { + stats->IncrementExportsFoundCounter(); auto desc = BuildMaps::Base::FieldReader::CreatePtr( desc_json, key.target, "export target", logger); auto flexible_vars = desc->ReadStringList("flexible_config"); @@ -128,8 +130,12 @@ void ExportRule( Logger::Log(LogLevel::Debug, "Querying serve endpoint for export target {}", key.target.ToString()); + exports_progress->TaskTracker().Start( + target_cache_key->Id().ToString()); target_cache_value = ServeApi::ServeTarget(*target_cache_key, *repo_key); + exports_progress->TaskTracker().Stop( + target_cache_key->Id().ToString()); from_just_serve = true; } #endif // BOOTSTRAP_BUILD_TOOL @@ -177,7 +183,12 @@ void ExportRule( info.ToString()); (*setter)(std::move(analysis_result)); - stats->IncrementExportsCachedCounter(); + if (from_just_serve) { + stats->IncrementExportsServedCounter(); + } + else { + stats->IncrementExportsCachedCounter(); + } return; } (*logger)(fmt::format("Reading target entry for key {} failed", -- cgit v1.2.3